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

Re: Accessing SendRequest when User Changes RowsPerPage on Paginator

Expand Messages
  • Lucas Smith
    Sounds like you ll want to set the generateRequest attribute with a function that builds the appropriate url.
    Message 1 of 3 , May 27, 2009
    • 0 Attachment
      Sounds like you'll want to set the generateRequest attribute with a function that builds the appropriate url.
      http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#config_generateRequest

      The default generateRequest is
      function(oState, oSelf) {
          // Set defaults
          oState = oState || {pagination:null, sortedBy:null};
          var sort = (oState.sortedBy) ? oState.sortedBy.key : oSelf.getColumnSet().keys[0].getKey();
          var dir = (oState.sortedBy && oState.sortedBy.dir === YAHOO.widget.DataTable.CLASS_DESC) ? "desc" : "asc";
          var startIndex = (oState.pagination) ? oState.pagination.recordOffset : 0;
          var results = (oState.pagination) ? oState.pagination.rowsPerPage : null;

          // Build the request
          return "sort=" + sort +
          "&dir=" + dir +
          "&startIndex=" + startIndex +
          ((results !== null) ? "&results=" + results : "");
      }


      Hope this helps,
      Luke

      --- In ydn-javascript@yahoogroups.com, "davemabe2000" <davemabe@...> wrote:
      >
      > I have a Datatable that uses server-side pagination. The user has access to a form that changes the parameters that are sent when to populate the Datatable.
      >
      > The problem occurs when the user changes the rowsperpage displayed on the paginator - it reverts back to the original request that was made, not the new URL that should be used to retrieve a custom subset of data.
      >
      > I'm able to handle when the user sorts a column via the sortColumn event. What event should I similarly handle for when the user changes the rowsperpage property on the paginator to give the Datatable a custom URL to use to retrieve the data?
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.