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

Datatable server side sorting problem

Expand Messages
  • karla.valencia
    Hi everybody, I have a question. I m using a datatable with server side pagination and I d like to add server side sorting. I already added this:
    Message 1 of 3 , Feb 1, 2008
    • 0 Attachment
      Hi everybody, I have a question. I'm using a datatable with server
      side pagination and I'd like to add server side sorting.

      I already added this:

      this.myDataTable.sortColumn = function(oColumn) {
      // Which direction
      var sDir = "asc";
      // Already sorted?
      if(oColumn.key === this.get("sortedBy").key) {
      sDir = (this.get("sortedBy").dir === "asc") ?
      "desc" : "asc";
      }

      var newRequest = "sort=" + oColumn.key + "&dir=" + sDir +
      "&results=100&startIndex=0";
      this.getDataSource().sendRequest(newRequest,
      this.onDataReturnInitializeTable, this);
      };

      as shown in this example:
      http://developer.yahoo.com/yui/examples/datatable/dt_serversorting.html

      and this:

      // Update the config sortedBy with new values
      var newSortedBy = {
      key: sortCol,
      dir: sortDir
      }
      oDataTable.set("sortedBy", newSortedBy);


      return oParsedResponse;
      in the "this.myDataSource.doBeforeCallback" function.

      My problem is when clicking the header of any column I get this error
      message:
      'this.get("sortedBy") has no properties'

      I have no idea why this happens.

      Any help is greatly appreciated.

      Thanks

      Karla V
    • karla.valencia
      If you have a server-side pagination / server - side sorting functional example I can see, I would aprecciate it. Thanks Karla V.
      Message 2 of 3 , Feb 1, 2008
      • 0 Attachment
        If you have a "server-side pagination / server - side sorting"
        functional example I can see, I would aprecciate it.

        Thanks

        Karla V.

        --- In ydn-javascript@yahoogroups.com, "karla.valencia"
        <karla.valencia@...> wrote:
        >
        > Hi everybody, I have a question. I'm using a datatable with server
        > side pagination and I'd like to add server side sorting.
        >
        > I already added this:
        >
        > this.myDataTable.sortColumn = function(oColumn) {
        > // Which direction
        > var sDir = "asc";
        > // Already sorted?
        > if(oColumn.key === this.get("sortedBy").key) {
        > sDir = (this.get("sortedBy").dir === "asc") ?
        > "desc" : "asc";
        > }
        >
        > var newRequest = "sort=" + oColumn.key + "&dir=" + sDir +
        > "&results=100&startIndex=0";
        > this.getDataSource().sendRequest(newRequest,
        > this.onDataReturnInitializeTable, this);
        > };
        >
        > as shown in this example:
        > http://developer.yahoo.com/yui/examples/datatable/dt_serversorting.html
        >
        > and this:
        >
        > // Update the config sortedBy with new values
        > var newSortedBy = {
        > key: sortCol,
        > dir: sortDir
        > }
        > oDataTable.set("sortedBy", newSortedBy);
        >
        >
        > return oParsedResponse;
        > in the "this.myDataSource.doBeforeCallback" function.
        >
        > My problem is when clicking the header of any column I get this error
        > message:
        > 'this.get("sortedBy") has no properties'
        >
        > I have no idea why this happens.
        >
        > Any help is greatly appreciated.
        >
        > Thanks
        >
        > Karla V
        >
      • Satyam
        http://www.satyam.com.ar/yui/dt_serverdriven.html ... From: karla.valencia To: Sent: Friday,
        Message 3 of 3 , Feb 2, 2008
        • 0 Attachment
          http://www.satyam.com.ar/yui/dt_serverdriven.html


          ----- Original Message -----
          From: "karla.valencia" <karla.valencia@...>
          To: <ydn-javascript@yahoogroups.com>
          Sent: Friday, February 01, 2008 8:34 PM
          Subject: [ydn-javascript] Re: Datatable server side sorting problem


          > If you have a "server-side pagination / server - side sorting"
          > functional example I can see, I would aprecciate it.
          >
          > Thanks
          >
          > Karla V.
          >
          > --- In ydn-javascript@yahoogroups.com, "karla.valencia"
          > <karla.valencia@...> wrote:
          >>
          >> Hi everybody, I have a question. I'm using a datatable with server
          >> side pagination and I'd like to add server side sorting.
          >>
          >> I already added this:
          >>
          >> this.myDataTable.sortColumn = function(oColumn) {
          >> // Which direction
          >> var sDir = "asc";
          >> // Already sorted?
          >> if(oColumn.key === this.get("sortedBy").key) {
          >> sDir = (this.get("sortedBy").dir === "asc") ?
          >> "desc" : "asc";
          >> }
          >>
          >> var newRequest = "sort=" + oColumn.key + "&dir=" + sDir +
          >> "&results=100&startIndex=0";
          >> this.getDataSource().sendRequest(newRequest,
          >> this.onDataReturnInitializeTable, this);
          >> };
          >>
          >> as shown in this example:
          >> http://developer.yahoo.com/yui/examples/datatable/dt_serversorting.html
          >>
          >> and this:
          >>
          >> // Update the config sortedBy with new values
          >> var newSortedBy = {
          >> key: sortCol,
          >> dir: sortDir
          >> }
          >> oDataTable.set("sortedBy", newSortedBy);
          >>
          >>
          >> return oParsedResponse;
          >> in the "this.myDataSource.doBeforeCallback" function.
          >>
          >> My problem is when clicking the header of any column I get this error
          >> message:
          >> 'this.get("sortedBy") has no properties'
          >>
          >> I have no idea why this happens.
          >>
          >> Any help is greatly appreciated.
          >>
          >> Thanks
          >>
          >> Karla V
          >>
          >
          >
          >
          >
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          > --
          > No virus found in this incoming message.
          > Checked by AVG Free Edition.
          > Version: 7.5.516 / Virus Database: 269.19.18/1254 - Release Date:
          > 31/01/2008 20:30
          >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.