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

51805Problem with server side sorting along with server side pagination

Expand Messages
  • nagaraj
    Sep 30, 2009
      I am trying to do server side sorting along with Server pagination..

      For sorting I am declaring the "sortable:true" in column def's as below:

      var myColumnDefs = [ {key:"XyzName", label:"<b>Xyz Name</b>",width:250,sortable:true},{key:"XyzCount", label:"<b> Xyz Count </b>",sortable:true}
      ];

      And in myConfigs I have declared generateRequest so that on each paginator action change it will call this function

      var myConfigs = {
      initialRequest : "{someRequest:{offset:0,maxResults:50},Xyz:ALL}",
      generateRequest :myRequestBuilder,
      dynamicData: true,
      paginator: new YAHOO.widget.Paginator({
      rowsPerPage: 50,
      template: YAHOO.widget.Paginator.TEMPLATE_ROWS_PER_PAGE,
      rowsPerPageOptions: [50,100,200],
      pageLinks: 5
      }),
      draggableColumns:true
      }


      And in myRequestBuilder I am writing like this:

      myRequestBuilder = function(opage, oSelf) {
      opage = opage || {pagination:null, sortedBy:null};
      var startIndex = (opage.pagination) ? opage.pagination.recordOffset : 0;
      var results = (opage.pagination) ? opage.pagination.rowsPerPage : 200;
      var some=myDataTable.get('sortedBy');
      alert("some: " + some.sortedBy.key);
      return '{ someRequest:{offset:' + 0 +',maxResults:' +results+'}, Xyz:ALL }';
      };


      My problem here is when I click on "Xyz Name" and "Xyz Count" header for sorting i can see that "myRequestBuilder()" is getting called..when I try to see the sorted column key its showing the "Xyz Name" key every time even when I click on "Xyz Count"

      And one more thing I have observed is that sorting cap symbol on the header is pointing to the "Xyz Name" column only even when I try to click on the "Xyz Count" also its showing on "Xyz Name" itself

      How can I get a datatable column name onClicking on that particular column

      Can you please suggest me where I am doing wrong?

      i have gone through the Examples which are kept on YUI blog but I am unable to get them.Can any one please help me out in this


      Thanks in Advance!
    • Show all 2 messages in this topic