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

Re: [ydn-javascript] Datatable sort does not work properly when columns fields are empty i.e. "".

Expand Messages
  • Satyam
    ... YUI 7.0? Where did you find it? ... The DataTable uses the native JavaScript Array.sort function so what you get is what that function produces. The
    Message 1 of 5 , Jun 1, 2009
    • 0 Attachment
      inna_work escribió:
      > I have a basic datatable in YUI 7.0 and some of the data in column is empty i.e. "".
      > Both of the sort orders on the columns don't work properly.
      >
      YUI 7.0? Where did you find it?
      > Here is an example of resulting sorts:
      >
      > n* -> "" -> s*
      > s* -> "" -> n*
      >
      >
      > This is what I would expect the sort to be:
      >
      > "" -> n* -> s*
      > s* -> n* -> ""
      >
      >
      > Is there a workaround for this or any suggested fixes?
      >

      The DataTable uses the native JavaScript Array.sort function so what you
      get is what that function produces. The question then is what is it
      that sort is being fed. Are you sure "" is really that and not the text
      "null" which would naturally go close to the end of the n*? Try to
      send "nula" and "nulz" and see where they fit, I guess you'll get your
      "" right in between.

      Satyam

      > Thanks,
      > Inna
      >
      >
      >
      >
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - www.avg.com
      > Version: 8.5.339 / Virus Database: 270.12.48/2148 - Release Date: 06/01/09 06:09:00
      >
      >
    • inna_work
      Thank you for the idea. The data that comes in is no . In column formatters I explicitly set the value of the cell to . if (oData == no ) {
      Message 2 of 5 , Jun 2, 2009
      • 0 Attachment
        Thank you for the idea.
        The data that comes in is "no".
        In column formatters I explicitly set the value of the cell to "".

        if (oData == "no") {
        elCell.innerHTML = "";
        }

        Looks like the formatter is being run every time a sort runs.
        Is there any other ideas or fixes for this?
        I was thinking that "" should always be either first or last depending on the sort order.

        Thanks,
        Inna


        --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
        >
        >
        >
        > inna_work escribió:
        > > I have a basic datatable in YUI 7.0 and some of the data in column is empty i.e. "".
        > > Both of the sort orders on the columns don't work properly.
        > >
        > YUI 7.0? Where did you find it?
        > > Here is an example of resulting sorts:
        > >
        > > n* -> "" -> s*
        > > s* -> "" -> n*
        > >
        > >
        > > This is what I would expect the sort to be:
        > >
        > > "" -> n* -> s*
        > > s* -> n* -> ""
        > >
        > >
        > > Is there a workaround for this or any suggested fixes?
        > >
        >
        > The DataTable uses the native JavaScript Array.sort function so what you
        > get is what that function produces. The question then is what is it
        > that sort is being fed. Are you sure "" is really that and not the text
        > "null" which would naturally go close to the end of the n*? Try to
        > send "nula" and "nulz" and see where they fit, I guess you'll get your
        > "" right in between.
        >
        > Satyam
        >
        > > Thanks,
        > > Inna
        > >
        > >
        > >
        > >
        > >
        > >
        > >
        > > ------------------------------------
        > >
        > > Yahoo! Groups Links
        > >
        > >
        > >
        > > ------------------------------------------------------------------------
        > >
        > >
        > > No virus found in this incoming message.
        > > Checked by AVG - www.avg.com
        > > Version: 8.5.339 / Virus Database: 270.12.48/2148 - Release Date: 06/01/09 06:09:00
        > >
        > >
        >
      • Satyam
        No, the formatter just formats the data in the RecordSet for the user to see. All operations are done with the Data as stored in the Recordset. Imagine if you
        Message 3 of 5 , Jun 2, 2009
        • 0 Attachment
          No, the formatter just formats the data in the RecordSet for the user to
          see. All operations are done with the Data as stored in the Recordset.
          Imagine if you were storing dates and some of your users use YYYYMMDD,
          others MMDDYYYY and the sensible ones ;-) DDMMYYYY, would you expect
          the columns containing dates sort differently depending on the result of
          the formatter?

          You should assign a parser to the column containing that data in the
          DataSource.responseSchema.fields array, changing that column from
          "fieldName" to

          {key:"fieldName,parser:function (value) { return (value=='no'?"":value)}

          All data should be likewise converted to native JavaScript values "1" to
          1, "true" to true, dates to native JavaScript Date objects and so on.

          Satyam


          inna_work escribió:
          > Thank you for the idea.
          > The data that comes in is "no".
          > In column formatters I explicitly set the value of the cell to "".
          >
          > if (oData == "no") {
          > elCell.innerHTML = "";
          > }
          >
          > Looks like the formatter is being run every time a sort runs.
          > Is there any other ideas or fixes for this?
          > I was thinking that "" should always be either first or last depending on the sort order.
          >
          > Thanks,
          > Inna
          >
          >
          > --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
          >
          >>
          >> inna_work escribió:
          >>
          >>> I have a basic datatable in YUI 7.0 and some of the data in column is empty i.e. "".
          >>> Both of the sort orders on the columns don't work properly.
          >>>
          >>>
          >> YUI 7.0? Where did you find it?
          >>
          >>> Here is an example of resulting sorts:
          >>>
          >>> n* -> "" -> s*
          >>> s* -> "" -> n*
          >>>
          >>>
          >>> This is what I would expect the sort to be:
          >>>
          >>> "" -> n* -> s*
          >>> s* -> n* -> ""
          >>>
          >>>
          >>> Is there a workaround for this or any suggested fixes?
          >>>
          >>>
          >> The DataTable uses the native JavaScript Array.sort function so what you
          >> get is what that function produces. The question then is what is it
          >> that sort is being fed. Are you sure "" is really that and not the text
          >> "null" which would naturally go close to the end of the n*? Try to
          >> send "nula" and "nulz" and see where they fit, I guess you'll get your
          >> "" right in between.
          >>
          >> Satyam
          >>
          >>
          >>> Thanks,
          >>> Inna
          >>>
          >>>
          >>>
          >>>
          >>>
          >>>
          >>>
          >>> ------------------------------------
          >>>
          >>> Yahoo! Groups Links
          >>>
          >>>
          >>>
          >>> ------------------------------------------------------------------------
          >>>
          >>>
          >>> No virus found in this incoming message.
          >>> Checked by AVG - www.avg.com
          >>> Version: 8.5.339 / Virus Database: 270.12.48/2148 - Release Date: 06/01/09 06:09:00
          >>>
          >>>
          >>>
          >
          >
          >
          >
          > ------------------------------------
          >
          > Yahoo! Groups Links
          >
          >
          >
          > ------------------------------------------------------------------------
          >
          >
          > No virus found in this incoming message.
          > Checked by AVG - www.avg.com
          > Version: 8.5.339 / Virus Database: 270.12.50/2150 - Release Date: 06/02/09 06:47:00
          >
          >
        • inna_work
          Thank you for a clear explanation of RecordSet usage, very helpful. Using parser instead of formatter has fixed the sort issue. Thanks, Inna
          Message 4 of 5 , Jun 2, 2009
          • 0 Attachment
            Thank you for a clear explanation of RecordSet usage, very helpful.

            Using parser instead of formatter has fixed the sort issue.

            Thanks,
            Inna


            --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
            >
            > No, the formatter just formats the data in the RecordSet for the user to
            > see. All operations are done with the Data as stored in the Recordset.
            > Imagine if you were storing dates and some of your users use YYYYMMDD,
            > others MMDDYYYY and the sensible ones ;-) DDMMYYYY, would you expect
            > the columns containing dates sort differently depending on the result of
            > the formatter?
            >
            > You should assign a parser to the column containing that data in the
            > DataSource.responseSchema.fields array, changing that column from
            > "fieldName" to
            >
            > {key:"fieldName,parser:function (value) { return (value=='no'?"":value)}
            >
            > All data should be likewise converted to native JavaScript values "1" to
            > 1, "true" to true, dates to native JavaScript Date objects and so on.
            >
            > Satyam
            >
            >
            > inna_work escribió:
            > > Thank you for the idea.
            > > The data that comes in is "no".
            > > In column formatters I explicitly set the value of the cell to "".
            > >
            > > if (oData == "no") {
            > > elCell.innerHTML = "";
            > > }
            > >
            > > Looks like the formatter is being run every time a sort runs.
            > > Is there any other ideas or fixes for this?
            > > I was thinking that "" should always be either first or last depending on the sort order.
            > >
            > > Thanks,
            > > Inna
            > >
            > >
            > > --- In ydn-javascript@yahoogroups.com, Satyam <satyam@> wrote:
            > >
            > >>
            > >> inna_work escribió:
            > >>
            > >>> I have a basic datatable in YUI 7.0 and some of the data in column is empty i.e. "".
            > >>> Both of the sort orders on the columns don't work properly.
            > >>>
            > >>>
            > >> YUI 7.0? Where did you find it?
            > >>
            > >>> Here is an example of resulting sorts:
            > >>>
            > >>> n* -> "" -> s*
            > >>> s* -> "" -> n*
            > >>>
            > >>>
            > >>> This is what I would expect the sort to be:
            > >>>
            > >>> "" -> n* -> s*
            > >>> s* -> n* -> ""
            > >>>
            > >>>
            > >>> Is there a workaround for this or any suggested fixes?
            > >>>
            > >>>
            > >> The DataTable uses the native JavaScript Array.sort function so what you
            > >> get is what that function produces. The question then is what is it
            > >> that sort is being fed. Are you sure "" is really that and not the text
            > >> "null" which would naturally go close to the end of the n*? Try to
            > >> send "nula" and "nulz" and see where they fit, I guess you'll get your
            > >> "" right in between.
            > >>
            > >> Satyam
            > >>
            > >>
            > >>> Thanks,
            > >>> Inna
            > >>>
            > >>>
            > >>>
            > >>>
            > >>>
            > >>>
            > >>>
            > >>> ------------------------------------
            > >>>
            > >>> Yahoo! Groups Links
            > >>>
            > >>>
            > >>>
            > >>> ------------------------------------------------------------------------
            > >>>
            > >>>
            > >>> No virus found in this incoming message.
            > >>> Checked by AVG - www.avg.com
            > >>> Version: 8.5.339 / Virus Database: 270.12.48/2148 - Release Date: 06/01/09 06:09:00
            > >>>
            > >>>
            > >>>
            > >
            > >
            > >
            > >
            > > ------------------------------------
            > >
            > > Yahoo! Groups Links
            > >
            > >
            > >
            > > ------------------------------------------------------------------------
            > >
            > >
            > > No virus found in this incoming message.
            > > Checked by AVG - www.avg.com
            > > Version: 8.5.339 / Virus Database: 270.12.50/2150 - Release Date: 06/02/09 06:47:00
            > >
            > >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.