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

serverside pagination

Expand Messages
  • antonganesh
    My datatable with server side pagination seems to behave strange. I m working with 13 records. I only display 5 records per page. When I navigate to last set
    Message 1 of 2 , Mar 19, 2008
    • 0 Attachment
      My datatable with server side pagination seems to behave strange. I'm
      working with 13 records. I only display 5 records per page. When I
      navigate to last set of records only 3 get displayed which is correct.
      The problem begins when I start navigating back. It always displays
      only 3 records for page. I feel, the datatable is not rendering
      properly. But when I visit the last set of records and go to the
      beginning everything works fine.

      Here is my code:

      this.myDataSource = new YAHOO.util.DataSource("data?");
      this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;

      this.myDataSource.responseSchema = {
      resultsList : 'records',
      totalRecords: 'totalRecords',
      fields: ["URL", "albumTitle", "itemsNum", "containerID"]
      };


      var buildQueryString = function (state,dt) {
      return "startIndex=" + (state.pagination.recordOffset -1) +
      "&results=" + state.pagination.rowsPerPage;
      };

      var myPaginator = new YAHOO.widget.Paginator({
      containers : ['paging'],
      pageLinks : 5,
      rowsPerPage : 5,
      rowsPerPageOptions : [5,10,15],
      template : " {PreviousPageLink} {PageLinks}
      {NextPageLink} {RowsPerPageDropdown}"
      });

      var paginationEvent = function(state, dt) {

      YAHOO.widget.DataTable.handleDataSourcePagination(state, dt);
      }

      var myTableConfig = {
      initialRequest : 'startIndex=0&results=5',
      generateRequest : buildQueryString,
      paginationEventHandler :
      YAHOO.widget.DataTable.handleDataSourcePagination,
      paginator : myPaginator
      };

      this.myDataTable = new YAHOO.widget.DataTable("yui_albums",
      myColumnDefs, this.myDataSource, myTableConfig);
    • y_lsmith
      Are you using 2.5.0 or 2.5.1? Do you have a sample page that I can look at? Luke
      Message 2 of 2 , Apr 1, 2008
      • 0 Attachment
        Are you using 2.5.0 or 2.5.1? Do you have a sample page that I can
        look at?

        Luke

        --- In ydn-javascript@yahoogroups.com, "antonganesh" <antonganesh@...>
        wrote:
        >
        > My datatable with server side pagination seems to behave strange. I'm
        > working with 13 records. I only display 5 records per page. When I
        > navigate to last set of records only 3 get displayed which is correct.
        > The problem begins when I start navigating back. It always displays
        > only 3 records for page. I feel, the datatable is not rendering
        > properly. But when I visit the last set of records and go to the
        > beginning everything works fine.
        >
        > Here is my code:
        >
        > this.myDataSource = new YAHOO.util.DataSource("data?");
        > this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
        >
        > this.myDataSource.responseSchema = {
        > resultsList : 'records',
        > totalRecords: 'totalRecords',
        > fields: ["URL", "albumTitle", "itemsNum", "containerID"]
        > };
        >
        >
        > var buildQueryString = function (state,dt) {
        > return "startIndex=" + (state.pagination.recordOffset -1) +
        > "&results=" + state.pagination.rowsPerPage;
        > };
        >
        > var myPaginator = new YAHOO.widget.Paginator({
        > containers : ['paging'],
        > pageLinks : 5,
        > rowsPerPage : 5,
        > rowsPerPageOptions : [5,10,15],
        > template : " {PreviousPageLink} {PageLinks}
        > {NextPageLink} {RowsPerPageDropdown}"
        > });
        >
        > var paginationEvent = function(state, dt) {
        >
        > YAHOO.widget.DataTable.handleDataSourcePagination(state, dt);
        > }
        >
        > var myTableConfig = {
        > initialRequest : 'startIndex=0&results=5',
        > generateRequest : buildQueryString,
        > paginationEventHandler :
        > YAHOO.widget.DataTable.handleDataSourcePagination,
        > paginator : myPaginator
        > };
        >
        > this.myDataTable = new YAHOO.widget.DataTable("yui_albums",
        > myColumnDefs, this.myDataSource, myTableConfig);
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.