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

Re: [ydn-javascript] Formatting decimals in DataTable

Expand Messages
  • Brian McCullough
    ... Have you considered writing a custom formatter for that field and converting the numbers into strings? Brian
    Message 1 of 8 , Feb 2, 2009
    • 0 Attachment
      On Mon, Feb 02, 2009 at 09:17:14PM -0000, gregraven@... wrote:
      > I've looked at all the documentation, but I can't figure out how to force DataTable to
      > display numbers as #.##. I have sortable tables and it looks better when the numerals are
      > aligned, but the trailing zero is getting axed somewhere in the process (they are present in
      > my data set).

      Have you considered writing a custom formatter for that field and
      converting the numbers into strings?


      Brian
    • Satyam
      You can declare the column to use the number formatter and use the numberOptions:
      Message 2 of 8 , Feb 2, 2009
      • 0 Attachment
        You can declare the column to use the number formatter and use the
        numberOptions:

        http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#config_numberOptions

        http://developer.yahoo.com/yui/docs/YAHOO.util.Number.html

        The number has to be an actual number, not a string containing digits.
        Use the number parser in the DataSource to make sure the received string
        of digits is made into a number.

        Satyam

        gregraven@... wrote:
        > I've looked at all the documentation, but I can't figure out how to force DataTable to
        > display numbers as #.##. I have sortable tables and it looks better when the numerals are
        > aligned, but the trailing zero is getting axed somewhere in the process (they are present in
        > my data set).
        >
        > Any help would be greatly appreciated.
        >
        > Thanks.
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        > ------------------------------------------------------------------------
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG - www.avg.com
        > Version: 8.0.233 / Virus Database: 270.10.16/1930 - Release Date: 01/31/09 20:03:00
        >
        >
      • gregraven@verizon.net
        Brian, Yes, I have. But because I don t know how to do that, it s tough sledding. ... are ... present in
        Message 3 of 8 , Feb 2, 2009
        • 0 Attachment
          Brian,

          Yes, I have. But because I don't know how to do that, it's tough sledding.

          --- In ydn-javascript@yahoogroups.com, Brian McCullough <bdmc@...> wrote:
          >
          > On Mon, Feb 02, 2009 at 09:17:14PM -0000, gregraven@... wrote:
          > > I've looked at all the documentation, but I can't figure out how to force DataTable to
          > > display numbers as #.##. I have sortable tables and it looks better when the numerals
          are
          > > aligned, but the trailing zero is getting axed somewhere in the process (they are
          present in
          > > my data set).
          >
          > Have you considered writing a custom formatter for that field and
          > converting the numbers into strings?
          >
          >
          > Brian
          >
        • gregraven@verizon.net
          Satyam, I am dealing with numbers (not a string that contains numerals), and this option appears to be exactly what I need for the configuration I m seeking.
          Message 4 of 8 , Feb 2, 2009
          • 0 Attachment
            Satyam,

            I am dealing with numbers (not a string that contains numerals), and this option appears
            to be exactly what I need for the configuration I'm seeking. However, I don't understand
            where to plug this code in to get what I want.

            Would you have a link to an example. I'm still getting up to speed on YUI. I love it, but my
            grasp is still a bit tenuous.

            --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
            >
            > You can declare the column to use the number formatter and use the
            > numberOptions:
            >
            >
            http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#config_numberOpti
            ons
            >
            > http://developer.yahoo.com/yui/docs/YAHOO.util.Number.html
            >
            > The number has to be an actual number, not a string containing digits.
            > Use the number parser in the DataSource to make sure the received string
            > of digits is made into a number.
            >
            > Satyam
            >
            > gregraven@... wrote:
            > > I've looked at all the documentation, but I can't figure out how to force DataTable to
            > > display numbers as #.##. I have sortable tables and it looks better when the numerals
            are
            > > aligned, but the trailing zero is getting axed somewhere in the process (they are
            present in
            > > my data set).
            > >
            > > Any help would be greatly appreciated.
            > >
            > > Thanks.
            > >
            > >
            > > ------------------------------------
            > >
            > > Yahoo! Groups Links
            > >
            > >
            > >
            > > ------------------------------------------------------------------
            ------
            > >
            > >
            > > No virus found in this incoming message.
            > > Checked by AVG - www.avg.com
            > > Version: 8.0.233 / Virus Database: 270.10.16/1930 - Release Date: 01/31/09
            20:03:00
            > >
            > >
            >
          • Brian McCullough
            ... Sorry about that. Satyam s solution will get you there. What we are talking about is the Column Definitions, where you list each of your displayed
            Message 5 of 8 , Feb 2, 2009
            • 0 Attachment
              On Tue, Feb 03, 2009 at 12:42:55AM -0000, gregraven@... wrote:
              > Brian,
              >
              > Yes, I have. But because I don't know how to do that, it's tough sledding.

              Sorry about that. Satyam's solution will get you there.


              What we are talking about is the Column Definitions, where you list each
              of your displayed columns, their field key name, and any other
              parameters you need, such as the Formatter.


              Brian
            • Satyam
              In the column definitions for the DataTable, you add to the definition of that particular column: {key: whatever , ...., formatter: number }, then you have two
              Message 6 of 8 , Feb 3, 2009
              • 0 Attachment
                In the column definitions for the DataTable, you add to the definition
                of that particular column:
                {key:"whatever", ...., formatter:"number"},

                then you have two choices, either you use the column numberOptions or
                the generic DataTable numberOptions. If the first, after adding the
                formatter, you simply add:

                , numberOptions: { your spec here }

                if the global one, you specify it in the fourth argument to the
                constructor of the DataTable, along initialRequest, caption or any
                others you might be using.

                Satyam


                gregraven@... wrote:
                > Satyam,
                >
                > I am dealing with numbers (not a string that contains numerals), and this option appears
                > to be exactly what I need for the configuration I'm seeking. However, I don't understand
                > where to plug this code in to get what I want.
                >
                > Would you have a link to an example. I'm still getting up to speed on YUI. I love it, but my
                > grasp is still a bit tenuous.
                >
                > --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
                >
                >> You can declare the column to use the number formatter and use the
                >> numberOptions:
                >>
                >>
                >>
                > http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#config_numberOpti
                > ons
                >
                >> http://developer.yahoo.com/yui/docs/YAHOO.util.Number.html
                >>
                >> The number has to be an actual number, not a string containing digits.
                >> Use the number parser in the DataSource to make sure the received string
                >> of digits is made into a number.
                >>
                >> Satyam
                >>
                >> gregraven@... wrote:
                >>
                >>> I've looked at all the documentation, but I can't figure out how to force DataTable to
                >>> display numbers as #.##. I have sortable tables and it looks better when the numerals
                >>>
                > are
                >
                >>> aligned, but the trailing zero is getting axed somewhere in the process (they are
                >>>
                > present in
                >
                >>> my data set).
                >>>
                >>> Any help would be greatly appreciated.
                >>>
                >>> Thanks.
                >>>
                >>>
                >>> ------------------------------------
                >>>
                >>> Yahoo! Groups Links
                >>>
                >>>
                >>>
                >>> ------------------------------------------------------------------
                >>>
                > ------
                >
                >>> No virus found in this incoming message.
                >>> Checked by AVG - www.avg.com
                >>> Version: 8.0.233 / Virus Database: 270.10.16/1930 - Release Date: 01/31/09
                >>>
                > 20:03:00
                >
                >>>
                >
                >
                >
                >
                >
                > ------------------------------------
                >
                > Yahoo! Groups Links
                >
                >
                >
                > ------------------------------------------------------------------------
                >
                >
                > No virus found in this incoming message.
                > Checked by AVG - www.avg.com
                > Version: 8.0.233 / Virus Database: 270.10.16/1930 - Release Date: 02/02/09 07:51:00
                >
                >
              • gregraven@verizon.net
                Beautiful! I got each option working perfectly. Thanks a million. ... appears ... understand ... my ...
                Message 7 of 8 , Feb 3, 2009
                • 0 Attachment
                  Beautiful!

                  I got each option working perfectly.

                  Thanks a million.

                  --- In ydn-javascript@yahoogroups.com, Satyam <satyam@...> wrote:
                  >
                  > In the column definitions for the DataTable, you add to the definition
                  > of that particular column:
                  > {key:"whatever", ...., formatter:"number"},
                  >
                  > then you have two choices, either you use the column numberOptions or
                  > the generic DataTable numberOptions. If the first, after adding the
                  > formatter, you simply add:
                  >
                  > , numberOptions: { your spec here }
                  >
                  > if the global one, you specify it in the fourth argument to the
                  > constructor of the DataTable, along initialRequest, caption or any
                  > others you might be using.
                  >
                  > Satyam
                  >
                  >
                  > gregraven@... wrote:
                  > > Satyam,
                  > >
                  > > I am dealing with numbers (not a string that contains numerals), and this option
                  appears
                  > > to be exactly what I need for the configuration I'm seeking. However, I don't
                  understand
                  > > where to plug this code in to get what I want.
                  > >
                  > > Would you have a link to an example. I'm still getting up to speed on YUI. I love it, but
                  my
                  > > grasp is still a bit tenuous.
                  > >
                  > > --- In ydn-javascript@yahoogroups.com, Satyam <satyam@> wrote:
                  > >
                  > >> You can declare the column to use the number formatter and use the
                  > >> numberOptions:
                  > >>
                  > >>
                  > >>
                  > >
                  http://developer.yahoo.com/yui/docs/YAHOO.widget.DataTable.html#config_numberOpti
                  > > ons
                  > >
                  > >> http://developer.yahoo.com/yui/docs/YAHOO.util.Number.html
                  > >>
                  > >> The number has to be an actual number, not a string containing digits.
                  > >> Use the number parser in the DataSource to make sure the received string
                  > >> of digits is made into a number.
                  > >>
                  > >> Satyam
                  > >>
                  > >> gregraven@ wrote:
                  > >>
                  > >>> I've looked at all the documentation, but I can't figure out how to force DataTable
                  to
                  > >>> display numbers as #.##. I have sortable tables and it looks better when the
                  numerals
                  > >>>
                  > > are
                  > >
                  > >>> aligned, but the trailing zero is getting axed somewhere in the process (they are
                  > >>>
                  > > present in
                  > >
                  > >>> my data set).
                  > >>>
                  > >>> Any help would be greatly appreciated.
                  > >>>
                  > >>> Thanks.
                  > >>>
                  > >>>
                  > >>> ------------------------------------
                  > >>>
                  > >>> Yahoo! Groups Links
                  > >>>
                  > >>>
                  > >>>
                  > >>> ---------------------------------------------------------------
                  ---
                  > >>>
                  > > ------
                  > >
                  > >>> No virus found in this incoming message.
                  > >>> Checked by AVG - www.avg.com
                  > >>> Version: 8.0.233 / Virus Database: 270.10.16/1930 - Release Date: 01/31/09
                  > >>>
                  > > 20:03:00
                  > >
                  > >>>
                  > >
                  > >
                  > >
                  > >
                  > >
                  > > ------------------------------------
                  > >
                  > > Yahoo! Groups Links
                  > >
                  > >
                  > >
                  > > ------------------------------------------------------------------
                  ------
                  > >
                  > >
                  > > No virus found in this incoming message.
                  > > Checked by AVG - www.avg.com
                  > > Version: 8.0.233 / Virus Database: 270.10.16/1930 - Release Date: 02/02/09
                  07:51:00
                  > >
                  > >
                  >
                Your message has been successfully submitted and would be delivered to recipients shortly.