Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] Re: DataTable pagination issue (YUI version 2.5.0)

Expand Messages
  • Satyam
    My own sample is not really different from the example along the docs, but it might give you some clue. http://www.satyam.com.ar/yui/2.5.0/dt_serverdriven.html
    Message 1 of 10 , May 1 6:04 AM
    • 0 Attachment
      My own sample is not really different from the example along the docs, but
      it might give you some clue.

      http://www.satyam.com.ar/yui/2.5.0/dt_serverdriven.html

      Satyam

      ----- Original Message -----
      From: "amirlaher" <amirlaher@...>
      To: <ydn-javascript@yahoogroups.com>
      Sent: Thursday, May 01, 2008 2:51 PM
      Subject: [ydn-javascript] Re: DataTable pagination issue (YUI version 2.5.0)


      > Hi Satyam, wow that was quick - thanks.
      >
      > I actually put that totalRecords in the constructor as an initial
      > attempt to remedy the problem. Sorry, I should have taken it out again
      > before posting. Just to be sure, I've taken it out and re-tried it. It
      > doesn't make any difference.
      >
      > I'll strip out the recordsReturned from the response, thanks.
      >
      > Any other ideas? If not I might have to dig deeper myself and perhaps
      > even submit a bug!
      >
      > Thanks for your swift response
      >
      > Amir
      >
      >
      >
      > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
      >>
      >> In the constructor to the Paginator you have:
      >>
      >> totalRecords: SENRO.clientsearch.resultcount,
      >>
      >> I am not sure what it might do. It is not required and I suspect
      > that if
      >> resultcount is zero or undefined, it might end up erasing
      > totalRecords as it
      >> came in the metaFields description. If that is so, when
      > totalRecords is
      >> undefined, the paginator reads the actual number of records present
      > in the
      >> data array, not the recordsReturned field, which it knows nothing
      > about, but
      >> it simply reads the length of the recordSet. That's what might be
      >> happening.
      >>
      >> Satyam
      >>
      >>
      >>
      >> ----- Original Message -----
      >> From: "amirlaher" <amirlaher@...>
      >> To: <ydn-javascript@yahoogroups.com>
      >> Sent: Thursday, May 01, 2008 11:54 AM
      >> Subject: [ydn-javascript] DataTable pagination issue (YUI version 2.5.0)
      >>
      >>
      >> > Hi there,
      >> >
      >> > The DataTable is a beautiful thing, but I've had one issue with it...
      >> >
      >> > I've got serverside pagination working, but for some reason the
      >> > totalRecords wasn't being recognised without a hack. For some reason
      >> > it uses the recordsReturned value in place of totalRecords.
      >> >
      >> > ::: My responseSchema looks like this:
      >> > SENRO.clientsearch.myDataSource.responseSchema = {
      >> > resultsList: 'records',
      >> > fields: getResponseSchemaFields(SENRO.clientsearch.columnDefs),
      >> > metaFields : {
      >> > totalRecords: 'totalRecords',
      >> > paginationRecordOffset : "startIndex"
      >> > }
      >> > };
      >> >
      >> > ::: My server's JSON results look like this:
      >> >
      > {"recordsReturned":300,"totalRecords":5222,"startIndex":0,"sort":null,"dir":"asc"","records":[{"status":"1",
      >> > ....
      >> > }
      >> >
      >> > ** My config looks like this
      >> > SENRO.clientsearch.configs = {
      >> > initialRequest : initRequest,
      >> > generateRequest : SENRO.clientsearch.buildQueryString,
      >> > paginator: new YAHOO.widget.Paginator({
      >> > rowsPerPage : 20,
      >> > template: "{FirstPageLink} {PreviousPageLink} {PageLinks}
      >> > {NextPageLink} {LastPageLink} {CurrentPageReport}",
      >> > pageReportTemplate : "Showing items {startIndex} - {endIndex} of
      >> > {totalRecords}",
      >> > totalRecords: SENRO.clientsearch.resultcount,
      >> >
      >> > }),
      >> > renderLoopSize : 20,
      >> > scrollable: false,
      >> > paginated: true,
      >> > // paginationEventHandler :
      >> > SENRO.clientsearch.handlePagination,
      >> > paginationEventHandler :
      >> > YAHOO.widget.DataTable.handleDataSourcePagination,
      >> > recordOffset: 0
      >> > };
      >> >
      >> > I haven't posted the whole of the code because it's not for public
      >> > consumption, let me know if you need more info.
      >> >
      >> > The hack I used to fix it was to store the totalRecords amount
      >> > separately in the page, and hack together a different
      >> > paginationEventHandler.
      >> > I copied and pasted the handleSimplePagination and
      >> > handleDataSourcePagination functions straight out of
      >> > datatable-beta-debug.js, and hard-coded the totalRecords value into my
      >> > modified handleSimplePagination function.
      >> >
      >> > I can live with this, but it's not ideal. I can't really figure out
      >> > what's wrong with my setup that it's not taking note of my
      >> > totalRecords value. Is this a known issue?
      >> >
      >> > Cheers,
      >> >
      >> > Amir
      >> >
      >> >
      >> > ------------------------------------
      >> >
      >> > Yahoo! Groups Links
      >> >
      >> >
      >> >
      >> >
      >> >
      >> > --
      >> > No virus found in this incoming message.
      >> > Checked by AVG.
      >> > Version: 7.5.524 / Virus Database: 269.23.7/1408 - Release Date:
      >> > 30/04/2008 18:10
      >> >
      >> >
      >>
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
      > --
      > No virus found in this incoming message.
      > Checked by AVG.
      > Version: 7.5.524 / Virus Database: 269.23.7/1408 - Release Date:
      > 30/04/2008 18:10
      >
      >
    • amirlaher
      Satyam you re a hero! Your example was enlightening, thanks. All I needed to do was define a doBeforeCallback: myDataSource.doBeforeCallback =
      Message 2 of 10 , May 1 8:12 AM
      • 0 Attachment
        Satyam you're a hero!

        Your example was enlightening, thanks.

        All I needed to do was define a doBeforeCallback:

        myDataSource.doBeforeCallback = function(oRequest, oFullResponse,
        oParsedResponse) {
        oParsedResponse.totalRecords =
        parseInt(SENRO.clientsearch.resultcount);
        return oParsedResponse;
        };

        My global object, SENRO, stores the totalRecords so I just used that -
        perfect.

        I'm not sure why it's necessary but this is a far more satisfactory
        workaround than the one I hacked together

        Thanks again, I'm bookmarking your example for future reference



        --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
        >
        > My own sample is not really different from the example along the
        docs, but
        > it might give you some clue.
        >
        > http://www.satyam.com.ar/yui/2.5.0/dt_serverdriven.html
        >
        > Satyam
        >
        > ----- Original Message -----
        > From: "amirlaher" <amirlaher@...>
        > To: <ydn-javascript@yahoogroups.com>
        > Sent: Thursday, May 01, 2008 2:51 PM
        > Subject: [ydn-javascript] Re: DataTable pagination issue (YUI
        version 2.5.0)
        >
        >
        > > Hi Satyam, wow that was quick - thanks.
        > >
        > > I actually put that totalRecords in the constructor as an initial
        > > attempt to remedy the problem. Sorry, I should have taken it out again
        > > before posting. Just to be sure, I've taken it out and re-tried it. It
        > > doesn't make any difference.
        > >
        > > I'll strip out the recordsReturned from the response, thanks.
        > >
        > > Any other ideas? If not I might have to dig deeper myself and perhaps
        > > even submit a bug!
        > >
        > > Thanks for your swift response
        > >
        > > Amir
        > >
        > >
        > >
        > > --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@> wrote:
        > >>
        > >> In the constructor to the Paginator you have:
        > >>
        > >> totalRecords: SENRO.clientsearch.resultcount,
        > >>
        > >> I am not sure what it might do. It is not required and I suspect
        > > that if
        > >> resultcount is zero or undefined, it might end up erasing
        > > totalRecords as it
        > >> came in the metaFields description. If that is so, when
        > > totalRecords is
        > >> undefined, the paginator reads the actual number of records present
        > > in the
        > >> data array, not the recordsReturned field, which it knows nothing
        > > about, but
        > >> it simply reads the length of the recordSet. That's what might be
        > >> happening.
        > >>
        > >> Satyam
        > >>
        > >>
        > >>
        > >> ----- Original Message -----
        > >> From: "amirlaher" <amirlaher@>
        > >> To: <ydn-javascript@yahoogroups.com>
        > >> Sent: Thursday, May 01, 2008 11:54 AM
        > >> Subject: [ydn-javascript] DataTable pagination issue (YUI version
        2.5.0)
        > >>
        > >>
        > >> > Hi there,
        > >> >
        > >> > The DataTable is a beautiful thing, but I've had one issue with
        it...
        > >> >
        > >> > I've got serverside pagination working, but for some reason the
        > >> > totalRecords wasn't being recognised without a hack. For some
        reason
        > >> > it uses the recordsReturned value in place of totalRecords.
        > >> >
        > >> > ::: My responseSchema looks like this:
        > >> > SENRO.clientsearch.myDataSource.responseSchema = {
        > >> > resultsList: 'records',
        > >> > fields:
        getResponseSchemaFields(SENRO.clientsearch.columnDefs),
        > >> > metaFields : {
        > >> > totalRecords: 'totalRecords',
        > >> > paginationRecordOffset : "startIndex"
        > >> > }
        > >> > };
        > >> >
        > >> > ::: My server's JSON results look like this:
        > >> >
        > >
        {"recordsReturned":300,"totalRecords":5222,"startIndex":0,"sort":null,"dir":"asc"","records":[{"status":"1",
        > >> > ....
        > >> > }
        > >> >
        > >> > ** My config looks like this
        > >> > SENRO.clientsearch.configs = {
        > >> > initialRequest : initRequest,
        > >> > generateRequest : SENRO.clientsearch.buildQueryString,
        > >> > paginator: new YAHOO.widget.Paginator({
        > >> > rowsPerPage : 20,
        > >> > template: "{FirstPageLink} {PreviousPageLink} {PageLinks}
        > >> > {NextPageLink} {LastPageLink} {CurrentPageReport}",
        > >> > pageReportTemplate : "Showing items {startIndex} - {endIndex} of
        > >> > {totalRecords}",
        > >> > totalRecords: SENRO.clientsearch.resultcount,
        > >> >
        > >> > }),
        > >> > renderLoopSize : 20,
        > >> > scrollable: false,
        > >> > paginated: true,
        > >> > // paginationEventHandler :
        > >> > SENRO.clientsearch.handlePagination,
        > >> > paginationEventHandler :
        > >> > YAHOO.widget.DataTable.handleDataSourcePagination,
        > >> > recordOffset: 0
        > >> > };
        > >> >
        > >> > I haven't posted the whole of the code because it's not for public
        > >> > consumption, let me know if you need more info.
        > >> >
        > >> > The hack I used to fix it was to store the totalRecords amount
        > >> > separately in the page, and hack together a different
        > >> > paginationEventHandler.
        > >> > I copied and pasted the handleSimplePagination and
        > >> > handleDataSourcePagination functions straight out of
        > >> > datatable-beta-debug.js, and hard-coded the totalRecords value
        into my
        > >> > modified handleSimplePagination function.
        > >> >
        > >> > I can live with this, but it's not ideal. I can't really figure out
        > >> > what's wrong with my setup that it's not taking note of my
        > >> > totalRecords value. Is this a known issue?
        > >> >
        > >> > Cheers,
        > >> >
        > >> > Amir
        > >> >
        > >> >
        > >> > ------------------------------------
        > >> >
        > >> > Yahoo! Groups Links
        > >> >
        > >> >
        > >> >
        > >> >
        > >> >
        > >> > --
        > >> > No virus found in this incoming message.
        > >> > Checked by AVG.
        > >> > Version: 7.5.524 / Virus Database: 269.23.7/1408 - Release Date:
        > >> > 30/04/2008 18:10
        > >> >
        > >> >
        > >>
        > >
        > >
        > >
        > > ------------------------------------
        > >
        > > Yahoo! Groups Links
        > >
        > >
        > >
        > >
        > >
        > > --
        > > No virus found in this incoming message.
        > > Checked by AVG.
        > > Version: 7.5.524 / Virus Database: 269.23.7/1408 - Release Date:
        > > 30/04/2008 18:10
        > >
        > >
        >
      • bretlevy
        Amir: Can you try taking the quotes off the object literals in your returned JSON? You said you return this:
        Message 3 of 10 , May 1 9:05 AM
        • 0 Attachment
          Amir:

          Can you try taking the quotes off the object literals in your
          returned JSON? You said you return this:

          {"recordsReturned":300,"totalRecords":5222,"startIndex":0,"sort":null,
          "dir":"asc"","records":[{"status":"1",...

          Try:

          {recordsReturned:300,totalRecords:5222,startIndex:0,sort:null,dir:"asc
          ",records:[{status:"1",...

          I also notice you have an extra quote (") after the "asc" value.
          This might solve your problem.

          Hope it helps...

          ~~bret



          --- In ydn-javascript@yahoogroups.com, "amirlaher" <amirlaher@...>
          wrote:
          >
          > Hi there,
          >
          > The DataTable is a beautiful thing, but I've had one issue with
          it...
          >
          > I've got serverside pagination working, but for some reason the
          > totalRecords wasn't being recognised without a hack. For some reason
          > it uses the recordsReturned value in place of totalRecords.
          >
          > ::: My responseSchema looks like this:
          > SENRO.clientsearch.myDataSource.responseSchema = {
          > resultsList: 'records',
          > fields: getResponseSchemaFields
          (SENRO.clientsearch.columnDefs),
          > metaFields : {
          > totalRecords: 'totalRecords',
          > paginationRecordOffset : "startIndex"
          > }
          > };
          >
          > ::: My server's JSON results look like this:
          >
          {"recordsReturned":300,"totalRecords":5222,"startIndex":0,"sort":null,
          "dir":"asc"","records":[{"status":"1",
          > ....
          > }
          >
          > ** My config looks like this
          > SENRO.clientsearch.configs = {
          > initialRequest : initRequest,
          > generateRequest :
          SENRO.clientsearch.buildQueryString,
          > paginator: new YAHOO.widget.Paginator
          ({
          > rowsPerPage : 20,
          > template: "{FirstPageLink}
          {PreviousPageLink} {PageLinks}
          > {NextPageLink} {LastPageLink} {CurrentPageReport}",
          > pageReportTemplate : "Showing
          items {startIndex} - {endIndex} of
          > {totalRecords}",
          > totalRecords:
          SENRO.clientsearch.resultcount,
          >
          > }),
          > renderLoopSize : 20,
          > scrollable: false,
          > paginated: true,
          > // paginationEventHandler :
          > SENRO.clientsearch.handlePagination,
          > paginationEventHandler :
          > YAHOO.widget.DataTable.handleDataSourcePagination,
          > recordOffset: 0
          > };
          >
          > I haven't posted the whole of the code because it's not for public
          > consumption, let me know if you need more info.
          >
          > The hack I used to fix it was to store the totalRecords amount
          > separately in the page, and hack together a different
          > paginationEventHandler.
          > I copied and pasted the handleSimplePagination and
          > handleDataSourcePagination functions straight out of
          > datatable-beta-debug.js, and hard-coded the totalRecords value into
          my
          > modified handleSimplePagination function.
          >
          > I can live with this, but it's not ideal. I can't really figure out
          > what's wrong with my setup that it's not taking note of my
          > totalRecords value. Is this a known issue?
          >
          > Cheers,
          >
          > Amir
          >
        • Satyam
          Actually, you might do worse by taking those quotes out. If you include the json component, the DataSource will use it and that one does expect the property
          Message 4 of 10 , May 1 9:21 AM
          • 0 Attachment
            Actually, you might do worse by taking those quotes out. If you include the
            json component, the DataSource will use it and that one does expect the
            property names to be enclosed in quotes, which is what the standard says.
            If you don't include YUI's JSON component, the original parser in the
            DataSource will tolerate those absent quotes.

            Satyam



            ----- Original Message -----
            From: "bretlevy" <bret@...>
            To: <ydn-javascript@yahoogroups.com>
            Sent: Thursday, May 01, 2008 6:05 PM
            Subject: [ydn-javascript] Re: DataTable pagination issue (YUI version 2.5.0)


            >
            > Amir:
            >
            > Can you try taking the quotes off the object literals in your
            > returned JSON? You said you return this:
            >
            > {"recordsReturned":300,"totalRecords":5222,"startIndex":0,"sort":null,
            > "dir":"asc"","records":[{"status":"1",...
            >
            > Try:
            >
            > {recordsReturned:300,totalRecords:5222,startIndex:0,sort:null,dir:"asc
            > ",records:[{status:"1",...
            >
            > I also notice you have an extra quote (") after the "asc" value.
            > This might solve your problem.
            >
            > Hope it helps...
            >
            > ~~bret
            >
            >
            >
            > --- In ydn-javascript@yahoogroups.com, "amirlaher" <amirlaher@...>
            > wrote:
            >>
            >> Hi there,
            >>
            >> The DataTable is a beautiful thing, but I've had one issue with
            > it...
            >>
            >> I've got serverside pagination working, but for some reason the
            >> totalRecords wasn't being recognised without a hack. For some reason
            >> it uses the recordsReturned value in place of totalRecords.
            >>
            >> ::: My responseSchema looks like this:
            >> SENRO.clientsearch.myDataSource.responseSchema = {
            >> resultsList: 'records',
            >> fields: getResponseSchemaFields
            > (SENRO.clientsearch.columnDefs),
            >> metaFields : {
            >> totalRecords: 'totalRecords',
            >> paginationRecordOffset : "startIndex"
            >> }
            >> };
            >>
            >> ::: My server's JSON results look like this:
            >>
            > {"recordsReturned":300,"totalRecords":5222,"startIndex":0,"sort":null,
            > "dir":"asc"","records":[{"status":"1",
            >> ....
            >> }
            >>
            >> ** My config looks like this
            >> SENRO.clientsearch.configs = {
            >> initialRequest : initRequest,
            >> generateRequest :
            > SENRO.clientsearch.buildQueryString,
            >> paginator: new YAHOO.widget.Paginator
            > ({
            >> rowsPerPage : 20,
            >> template: "{FirstPageLink}
            > {PreviousPageLink} {PageLinks}
            >> {NextPageLink} {LastPageLink} {CurrentPageReport}",
            >> pageReportTemplate : "Showing
            > items {startIndex} - {endIndex} of
            >> {totalRecords}",
            >> totalRecords:
            > SENRO.clientsearch.resultcount,
            >>
            >> }),
            >> renderLoopSize : 20,
            >> scrollable: false,
            >> paginated: true,
            >> // paginationEventHandler :
            >> SENRO.clientsearch.handlePagination,
            >> paginationEventHandler :
            >> YAHOO.widget.DataTable.handleDataSourcePagination,
            >> recordOffset: 0
            >> };
            >>
            >> I haven't posted the whole of the code because it's not for public
            >> consumption, let me know if you need more info.
            >>
            >> The hack I used to fix it was to store the totalRecords amount
            >> separately in the page, and hack together a different
            >> paginationEventHandler.
            >> I copied and pasted the handleSimplePagination and
            >> handleDataSourcePagination functions straight out of
            >> datatable-beta-debug.js, and hard-coded the totalRecords value into
            > my
            >> modified handleSimplePagination function.
            >>
            >> I can live with this, but it's not ideal. I can't really figure out
            >> what's wrong with my setup that it's not taking note of my
            >> totalRecords value. Is this a known issue?
            >>
            >> Cheers,
            >>
            >> Amir
            >>
            >
            >
            >
            > ------------------------------------
            >
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
            > --
            > No virus found in this incoming message.
            > Checked by AVG.
            > Version: 7.5.524 / Virus Database: 269.23.7/1408 - Release Date:
            > 30/04/2008 18:10
            >
            >
          • y_lsmith
            Amir, Version 2.5.1 of DataSource introduced the metaFields collection. In version 2.5.0, the totalRecords identifier hangs directly off of the responseSchema
            Message 5 of 10 , May 1 11:49 AM
            • 0 Attachment
              Amir,

              Version 2.5.1 of DataSource introduced the metaFields collection. In
              version 2.5.0, the totalRecords identifier hangs directly off of the
              responseSchema object. Try
              SENRO.clientsearch.myDataSource.responseSchema = {
              resultsList: 'records',
              fields: getResponseSchemaFields(SENRO.clientsearch.columnDefs),
              totalRecords: 'totalRecords'
              };

              Note paginationRecordOffset and other magic meta were also introduced
              in 2.5.1 as well.

              Hope this helps,
              Luke

              --- In ydn-javascript@yahoogroups.com, "amirlaher" <amirlaher@...> wrote:
              >
              > Hi there,
              >
              > The DataTable is a beautiful thing, but I've had one issue with it...
              >
              > I've got serverside pagination working, but for some reason the
              > totalRecords wasn't being recognised without a hack. For some reason
              > it uses the recordsReturned value in place of totalRecords.
              >
              > ::: My responseSchema looks like this:
              > SENRO.clientsearch.myDataSource.responseSchema = {
              > resultsList: 'records',
              > fields:
              getResponseSchemaFields(SENRO.clientsearch.columnDefs),
              > metaFields : {
              > totalRecords: 'totalRecords',
              > paginationRecordOffset : "startIndex"
              > }
              > };
              >
              > ::: My server's JSON results look like this:
              >
              {"recordsReturned":300,"totalRecords":5222,"startIndex":0,"sort":null,"dir":"asc"","records":[{"status":"1",
              > ....
              > }
              >
              > ** My config looks like this
              > SENRO.clientsearch.configs = {
              > initialRequest : initRequest,
              > generateRequest : SENRO.clientsearch.buildQueryString,
              > paginator: new YAHOO.widget.Paginator({
              > rowsPerPage : 20,
              > template: "{FirstPageLink} {PreviousPageLink} {PageLinks}
              > {NextPageLink} {LastPageLink} {CurrentPageReport}",
              > pageReportTemplate : "Showing items {startIndex} - {endIndex} of
              > {totalRecords}",
              > totalRecords: SENRO.clientsearch.resultcount,
              >
              > }),
              > renderLoopSize : 20,
              > scrollable: false,
              > paginated: true,
              > // paginationEventHandler :
              > SENRO.clientsearch.handlePagination,
              > paginationEventHandler :
              > YAHOO.widget.DataTable.handleDataSourcePagination,
              > recordOffset: 0
              > };
              >
              > I haven't posted the whole of the code because it's not for public
              > consumption, let me know if you need more info.
              >
              > The hack I used to fix it was to store the totalRecords amount
              > separately in the page, and hack together a different
              > paginationEventHandler.
              > I copied and pasted the handleSimplePagination and
              > handleDataSourcePagination functions straight out of
              > datatable-beta-debug.js, and hard-coded the totalRecords value into my
              > modified handleSimplePagination function.
              >
              > I can live with this, but it's not ideal. I can't really figure out
              > what's wrong with my setup that it's not taking note of my
              > totalRecords value. Is this a known issue?
              >
              > Cheers,
              >
              > Amir
              >
            • amirlaher
              Aha! That clears up a lot of confusion - thanks Luke. This works beautifully. I ve been reading the current documents (relating to 2.5.1), and didn t realise
              Message 6 of 10 , May 2 7:28 AM
              • 0 Attachment
                Aha! That clears up a lot of confusion - thanks Luke.
                This works beautifully.
                I've been reading the current documents (relating to 2.5.1), and didn't
                realise the differences in the specifications. I guess it's still in
                beta, so fair enough
                I will try to upgrade to 2.5.1 as soon as.
                Thanks very much,
                Amir

                --- In ydn-javascript@yahoogroups.com, "y_lsmith" <lsmith@...> wrote:
                >
                > Amir,
                >
                > Version 2.5.1 of DataSource introduced the metaFields collection. In
                > version 2.5.0, the totalRecords identifier hangs directly off of the
                > responseSchema object. Try
                > SENRO.clientsearch.myDataSource.responseSchema = {
                > resultsList: 'records',
                > fields: getResponseSchemaFields(SENRO.clientsearch.columnDefs),
                > totalRecords: 'totalRecords'
                > };
                >
                > Note paginationRecordOffset and other magic meta were also introduced
                > in 2.5.1 as well.
                >
                > Hope this helps,
                > Luke
                >
                > --- In ydn-javascript@yahoogroups.com, "amirlaher" amirlaher@ wrote:
                > >
                > > Hi there,
                > >
                > > The DataTable is a beautiful thing, but I've had one issue with
                it...
                > >
                > > I've got serverside pagination working, but for some reason the
                > > totalRecords wasn't being recognised without a hack. For some reason
                > > it uses the recordsReturned value in place of totalRecords.
                > >
                > > ::: My responseSchema looks like this:
                > > SENRO.clientsearch.myDataSource.responseSchema = {
                > > resultsList: 'records',
                > > fields:
                > getResponseSchemaFields(SENRO.clientsearch.columnDefs),
                > > metaFields : {
                > > totalRecords: 'totalRecords',
                > > paginationRecordOffset : "startIndex"
                > > }
                > > };
                > >
                > > ::: My server's JSON results look like this:
                > >
                >
                {"recordsReturned":300,"totalRecords":5222,"startIndex":0,"sort":null,"d\
                ir":"asc"","records":[{"status":"1",
                > > ....
                > > }
                > >
                > > ** My config looks like this
                > > SENRO.clientsearch.configs = {
                > > initialRequest : initRequest,
                > > generateRequest : SENRO.clientsearch.buildQueryString,
                > > paginator: new YAHOO.widget.Paginator({
                > > rowsPerPage : 20,
                > > template: "{FirstPageLink} {PreviousPageLink} {PageLinks}
                > > {NextPageLink} {LastPageLink} {CurrentPageReport}",
                > > pageReportTemplate : "Showing items {startIndex} - {endIndex}
                of
                > > {totalRecords}",
                > > totalRecords: SENRO.clientsearch.resultcount,
                > >
                > > }),
                > > renderLoopSize : 20,
                > > scrollable: false,
                > > paginated: true,
                > > // paginationEventHandler :
                > > SENRO.clientsearch.handlePagination,
                > > paginationEventHandler :
                > > YAHOO.widget.DataTable.handleDataSourcePagination,
                > > recordOffset: 0
                > > };
                > >
                > > I haven't posted the whole of the code because it's not for public
                > > consumption, let me know if you need more info.
                > >
                > > The hack I used to fix it was to store the totalRecords amount
                > > separately in the page, and hack together a different
                > > paginationEventHandler.
                > > I copied and pasted the handleSimplePagination and
                > > handleDataSourcePagination functions straight out of
                > > datatable-beta-debug.js, and hard-coded the totalRecords value into
                my
                > > modified handleSimplePagination function.
                > >
                > > I can live with this, but it's not ideal. I can't really figure out
                > > what's wrong with my setup that it's not taking note of my
                > > totalRecords value. Is this a known issue?
                > >
                > > Cheers,
                > >
                > > Amir
                > >
                >
              • amirlaher
                Cool, I ve left those quotes in. The problem was elsewhere anyway (see Luke s response on this topic) I m actually using Zend_Json to generate the JSON from
                Message 7 of 10 , May 2 7:32 AM
                • 0 Attachment
                  Cool, I've left those quotes in. The problem was elsewhere anyway (see
                  Luke's response on this topic)

                  I'm actually using Zend_Json to generate the JSON from php, so I
                  really didn't want to hack at it, and I'm relieved to hear you say
                  it's more compliant this way anyway

                  Cheers,

                  Amir


                  --- In ydn-javascript@yahoogroups.com, "Satyam" <satyam@...> wrote:
                  >
                  > Actually, you might do worse by taking those quotes out. If you
                  include the
                  > json component, the DataSource will use it and that one does expect the
                  > property names to be enclosed in quotes, which is what the standard
                  says.
                  > If you don't include YUI's JSON component, the original parser in the
                  > DataSource will tolerate those absent quotes.
                  >
                  > Satyam
                  >
                  >
                  >
                  > ----- Original Message -----
                  > From: "bretlevy" <bret@...>
                  > To: <ydn-javascript@yahoogroups.com>
                  > Sent: Thursday, May 01, 2008 6:05 PM
                  > Subject: [ydn-javascript] Re: DataTable pagination issue (YUI
                  version 2.5.0)
                  >
                  >
                  > >
                  > > Amir:
                  > >
                  > > Can you try taking the quotes off the object literals in your
                  > > returned JSON? You said you return this:
                  > >
                  > > {"recordsReturned":300,"totalRecords":5222,"startIndex":0,"sort":null,
                  > > "dir":"asc"","records":[{"status":"1",...
                  > >
                  > > Try:
                  > >
                  > > {recordsReturned:300,totalRecords:5222,startIndex:0,sort:null,dir:"asc
                  > > ",records:[{status:"1",...
                  > >
                  > > I also notice you have an extra quote (") after the "asc" value.
                  > > This might solve your problem.
                  > >
                  > > Hope it helps...
                  > >
                  > > ~~bret
                  > >
                  > >
                  > >
                  > > --- In ydn-javascript@yahoogroups.com, "amirlaher" <amirlaher@>
                  > > wrote:
                  > >>
                  > >> Hi there,
                  > >>
                  > >> The DataTable is a beautiful thing, but I've had one issue with
                  > > it...
                  > >>
                  > >> I've got serverside pagination working, but for some reason the
                  > >> totalRecords wasn't being recognised without a hack. For some reason
                  > >> it uses the recordsReturned value in place of totalRecords.
                  > >>
                  > >> ::: My responseSchema looks like this:
                  > >> SENRO.clientsearch.myDataSource.responseSchema = {
                  > >> resultsList: 'records',
                  > >> fields: getResponseSchemaFields
                  > > (SENRO.clientsearch.columnDefs),
                  > >> metaFields : {
                  > >> totalRecords: 'totalRecords',
                  > >> paginationRecordOffset : "startIndex"
                  > >> }
                  > >> };
                  > >>
                  > >> ::: My server's JSON results look like this:
                  > >>
                  > > {"recordsReturned":300,"totalRecords":5222,"startIndex":0,"sort":null,
                  > > "dir":"asc"","records":[{"status":"1",
                  > >> ....
                  > >> }
                  > >>
                  > >> ** My config looks like this
                  > >> SENRO.clientsearch.configs = {
                  > >> initialRequest : initRequest,
                  > >> generateRequest :
                  > > SENRO.clientsearch.buildQueryString,
                  > >> paginator: new YAHOO.widget.Paginator
                  > > ({
                  > >> rowsPerPage : 20,
                  > >> template: "{FirstPageLink}
                  > > {PreviousPageLink} {PageLinks}
                  > >> {NextPageLink} {LastPageLink} {CurrentPageReport}",
                  > >> pageReportTemplate : "Showing
                  > > items {startIndex} - {endIndex} of
                  > >> {totalRecords}",
                  > >> totalRecords:
                  > > SENRO.clientsearch.resultcount,
                  > >>
                  > >> }),
                  > >> renderLoopSize : 20,
                  > >> scrollable: false,
                  > >> paginated: true,
                  > >> // paginationEventHandler :
                  > >> SENRO.clientsearch.handlePagination,
                  > >> paginationEventHandler :
                  > >> YAHOO.widget.DataTable.handleDataSourcePagination,
                  > >> recordOffset: 0
                  > >> };
                  > >>
                  > >> I haven't posted the whole of the code because it's not for public
                  > >> consumption, let me know if you need more info.
                  > >>
                  > >> The hack I used to fix it was to store the totalRecords amount
                  > >> separately in the page, and hack together a different
                  > >> paginationEventHandler.
                  > >> I copied and pasted the handleSimplePagination and
                  > >> handleDataSourcePagination functions straight out of
                  > >> datatable-beta-debug.js, and hard-coded the totalRecords value into
                  > > my
                  > >> modified handleSimplePagination function.
                  > >>
                  > >> I can live with this, but it's not ideal. I can't really figure out
                  > >> what's wrong with my setup that it's not taking note of my
                  > >> totalRecords value. Is this a known issue?
                  > >>
                  > >> Cheers,
                  > >>
                  > >> Amir
                  > >>
                  > >
                  > >
                  > >
                  > > ------------------------------------
                  > >
                  > > Yahoo! Groups Links
                  > >
                  > >
                  > >
                  > >
                  > >
                  > > --
                  > > No virus found in this incoming message.
                  > > Checked by AVG.
                  > > Version: 7.5.524 / Virus Database: 269.23.7/1408 - Release Date:
                  > > 30/04/2008 18:10
                  > >
                  > >
                  >
                Your message has been successfully submitted and would be delivered to recipients shortly.