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

Re: DataTable not sorting integers properly right away.

Expand Messages
  • Jamie
    I am not sure if you guys are understanding what I am trying to say. The sorting and default sorting works fine (great even) with dates and text, even from the
    Message 1 of 6 , Jun 2, 2008
    • 0 Attachment
      I am not sure if you guys are understanding what I am trying to say.
      The sorting and default sorting works fine (great even) with dates and
      text, even from the start. It is numbers that it is having problems
      with if it is sorted by a number by default.

      var myDataTable = new YAHOO.widget.DataTable("dataTable", myColumns,
      myDataSource,
      {sortedBy:{key:"school_name",dir:"asc"}});

      The code above if I change to a column with a number, the table will
      not sort properly on default. I have to click another field and then
      back to the id and it will sort properly. The date and string sort
      fine from the beginning, not the numbers.

      Thanks,

      Jamie

      --- In ydn-javascript@yahoogroups.com, "y_lsmith" <lsmith@...> wrote:
      >
      > Jamie,
      >
      > Additionally, there is an optimization in DataTable (that needs
      > review, admittedly) to respond to sort requests on columns that are
      > currently sorted, or in your case *believe they are sorted*, to simply
      > reverse the order. This is why repeated requests to resort the ID
      > column failed until you requested a sort on another column.
      >
      > Luke
      >
      >
      > --- In ydn-javascript@yahoogroups.com, "jennykhan" <jennyhan@> wrote:
      > >
      > > Hi Jamie,
      > >
      > > The "sortedBy" property does not actually sort any data. In the case
      > > that your data is already sorted, you use that value to render the
      > > appropriate UI on the already-sorted Column. If you'd like to sort
      > > data, you should call the sortColumn() method.
      > >
      > > Hope that helps,
      > > Jenny
      > >
      > >
      > >
      > >
      > >
      > > --- In ydn-javascript@yahoogroups.com, "Jamie" <jamierytlewski@>
      > > wrote:
      > > >
      > > > As a follow up:
      > > >
      > > >
      > >
      http://developer.yahoo.com/yui/examples/datatable/dt_enhanced_clean.htm
      > > l
      > > >
      > > > I took the code from that page. Made the quantity the sorted by as
      > > > default and it did not sort properly.
      > > >
      > >
      >
    • y_lsmith
      ... Jamie, I guess I still don t understand what you re trying to say. Do you have a page we could look at? If not, * Are you using an HTMLTABLE type
      Message 2 of 6 , Jun 2, 2008
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "Jamie" <jamierytlewski@...> wrote:
        >
        > I am not sure if you guys are understanding what I am trying to say.
        > The sorting and default sorting works fine (great even) with dates and
        > text, even from the start. It is numbers that it is having problems
        > with if it is sorted by a number by default.
        >
        > var myDataTable = new YAHOO.widget.DataTable("dataTable", myColumns,
        > myDataSource,
        > {sortedBy:{key:"school_name",dir:"asc"}});
        >
        > The code above if I change to a column with a number, the table will
        > not sort properly on default. I have to click another field and then
        > back to the id and it will sort properly. The date and string sort
        > fine from the beginning, not the numbers.
        >
        > Thanks,
        >
        > Jamie
        >

        Jamie,

        I guess I still don't understand what you're trying to say. Do you
        have a page we could look at? If not,
        * Are you using an HTMLTABLE type DataSource for progressive enhancement?
        * Does your DataSource fields definition for the numeric column use
        the parser DataSource.parseNumber?
        * Is the existing table, before any JavaScript executes, sorted? If
        so, by which column?
        * Does the DataTable's constructor parameter sortedBy match the column
        the existing table is sorted by? Or correctly omitted if the table is
        not pre-sorted?
        * Have you tried removing the sortedBy configuration?
        * Does the DataTable sort incorrectly in response to a column head
        click after initialized with data pre-sorted by a column other than
        the numeric column? By the numeric column? With or without the
        sortedBy config?

        Luke
      Your message has been successfully submitted and would be delivered to recipients shortly.