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

30132Re: DataTable pagination issue (YUI version 2.5.0)

Expand Messages
  • y_lsmith
    May 1, 2008
    • 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
      >
    • Show all 10 messages in this topic