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

Re: Problem with server side sorting along with server side pagination

Expand Messages
  • nagaraj
    i even tried to write like this in myRequestBuilder: var myRequestBuilder = function(opage, oSelf) { opage = opage || {pagination:null, sortedBy:null}; var
    Message 1 of 2 , Oct 1, 2009
    • 0 Attachment
      i even tried to write like this in myRequestBuilder:

      var 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 sort = (opage.sortedBy) ? opage.sortedBy.key : "myDefaultColumnKey";
      var dir = (opage.sortedBy && opage.sortedBy.dir === YAHOO.widget.DataTable.CLASS_DESC) ? "desc" : "asc";
      var name=Dom.get('search_input').value;
      return '{SomeReq:{offset:' + 0 +',maxResults:' +results+'},XYZName:"'+(name)+'",sort:'+sort+',dir:'+dir+'}';
      };
      Though the out come is same its sending the first column name as the sorted key value when i click on other column headers...

      When i tried to remove the "sortable:true" for the column

      {key:"XyzName", label:"<b>Xyz Name</b>",width:250}..myColumnDefs looks like this after removing of "sortable:true":

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

      ];

      as a result i am unable to perform the sort on this column and when i try to Click(sort) on "Xyz Count" header its redirecting to the status 404 exception. i am unable to understand where exactly i am doing wrong

      Thanks in Advance!!



      --- In ydn-javascript@yahoogroups.com, "nagaraj" <manne_swiss@...> wrote:
      >
      > 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!
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.