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

Re: [ydn-javascript] Problem about sorting a column when reloading the datatable

Expand Messages
  • Ted Husted
    Does the DataTable track which column was last used for a sort? The use case would be to restore the current sort order (whatever it may be) after inserting a
    Message 1 of 5 , May 31, 2007
    • 0 Attachment
      Does the DataTable track which column was last used for a sort?

      The use case would be to restore the current sort order (whatever it may be)
      after inserting a new record or refreshing the recordset.

      -Ted.


      jennykhan wrote:
      >
      > Hi there,
      >
      > When you are calling myDataTable.sortColumn(oColumn), be sure that the
      > oColumn you are passing in is an instance of the Column object. For
      > instance,
      >
      > // Sorts the first column
      > var oFirstColumn = myDataTable.getColumnSet.keys[0];
      > myDataTable.sortColumn(oFirstColumn);
      >
      > // Sorts the last column
      > var oLastColumn =
      > myDataTable.getColumnSet.keys[myDataTable.getColumnSet.keys.length-1];
      > myDataTable.sortColumn(oLastColumn);
      >
      > If you are still seeing errors, please post a URL to your page, or
      > paste in the entirety of your code so we can help troubleshoot.
      >
      > Thanks,
      > Jenny
      >
      >
      >
      >
      > --- In ydn-javascript@yahoogroups.com, "erincarikan" <erincarikan@...>
      > wrote:
      >>
      >> Let me restate the problem because previous post seems ambiguous and
      >> couldn't find a way to edit that. When I reload my datatable, I use
      >> populateTable method, to keep the currentPage constant in paginated
      >> datatable. But this method doesn't keep the order that I created by
      >> sorting, in a complex datatable, so after the table is populated
      >> again, I use sortColumn method to sort it by a column. inside that
      >> method, ocolumn.getId() method raises an error. When I am setting up
      >> the header objects, is there way for me set the id explicitly, I
      >> checked the documentation, it seems to me that there's no attribute
      >> to set id of the column and id is set internally, so my column
      >> declaration is as follows:
      >>
      >> gridColumns[0] = {key:"PimId", text:"PIM", width:"50", type:"string",
      >> sortable:"true", resizeable:"true", sortOptions:
      >> {ascFunction:YAHOO.sortPimAsc,descFunction:YAHOO.sortPimDesc}};
      >>
      >> So I wonder why _table.sortColumn(gridColumns[0]) gives an error.
      >>
      >> --- In ydn-javascript@yahoogroups.com, "erincarikan"
      >> <erincarikan@> wrote:
      >> >
      >> > The problem is in sortColumn, column_object.getId() can not find an
      >> Id,
      >> > when defining the column, do we have to set the id, because I don't
      >> > know how to do that, can somebody help e with the problem?
      >> >
      >> > --- In ydn-javascript@yahoogroups.com, "erincarikan" <erincarikan@>
      >> > wrote:
      >> > >
      >> > > Hi;
      >> > >
      >> > > I am reloading the datatable by using the populateTable method,
      >> > > everything works with the pagination, but I want to sort by a
      >> column
      >> > > after that point, sortColumn(column_object) works but page gives
      >> an
      >> > > error, what am I missing? and how to sort asc or desc when
      >> reloading
      >> > > the datatable, is there any other method for that. Please help me.
      >> > >
      >> >
      >>
      >
      >
      >
      >

      --
      View this message in context: http://www.nabble.com/Problem-about-sorting-a-column-when-reloading-the-datatable-tf3776916.html#a10894273
      Sent from the ydn-javascript mailing list archive at Nabble.com.
    Your message has been successfully submitted and would be delivered to recipients shortly.