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

DataTable with Varying Types in a Given Column?

Expand Messages
  • Randall R Schulz
    Hi, I am working toward using DataTable to implement a configuration settings viewer and editor (using in-line editing) in which the settings value column
    Message 1 of 12 , Dec 2, 2007
    • 0 Attachment
      Hi,

      I am working toward using DataTable to implement a configuration
      settings viewer and editor (using in-line editing) in which the
      settings' value column (the editable one) holds values of varying
      types, including booleans (displayed as "yes" / "no"), strings and
      numbers (both integers and floats). I'm conveying the information to
      the page in JSON and use proper native JavaScript types for each
      individual value.

      Satyam's DataTable tutorial blog (part 1) suggests that each column must
      contain type-homogeneous data, insofar as it uses a fixed schema across
      all rows in a given table.

      Is this just a special, simpler case? Is it possible to have more than
      one kind of data in a given column? If so, what's required to achieve
      it? In particular, can cell editors be assigned to individual cells
      rather than to all the cells in a column?

      If row-varying cell types are impossible (or particularly difficult),
      I'll have to rethink how to implement the settings editor.


      Thanks.

      Randall Schulz
    • Satyam
      The DataTable is basically meant to be the visual representation of a database table with its normal columns and records. Data type information is not stored
      Message 2 of 12 , Dec 2, 2007
      • 0 Attachment
        The DataTable is basically meant to be the visual representation of a
        database table with its normal columns and records. Data type information
        is not stored on a cell per cell basis but there is only one columns
        definition array which stores a single definition per column of data for all
        the records. What you are looking for is a DataGrid where there is no such
        structure as a database table usually has.

        You could define a generic formatter and editor for all of the columns which
        might branch of to the different cell formatters and editors depending on
        the column and the record. You might have extra hidden columns that store
        information related to the visible cells so each formatter or editor, upon
        checking the column and the record it is in, might decide to which specific
        editor it should branch.

        Like:

        myColumnDefs = [
        {key:'col1',formatter:this.myFormatterDispatcher,
        editor:this.myEditorDispatcher, ...

        Both your dispatchers would have to have the argument signature of the
        regular formatter and editor:

        this.myFormatterDispatcher = function(elCell, oRecord, oColumn,oData)

        this.myEditorDispatcher = function(oEditor, oSelf)

        Both have information both from the column and all the fields in the record,
        both visible and hidden, and can call the corresponding method passing it
        the very same arguments it has received.

        Satyam




        ----- Original Message -----
        From: "Randall R Schulz" <rschulz@...>
        To: <ydn-javascript@yahoogroups.com>
        Sent: Sunday, December 02, 2007 9:09 PM
        Subject: [ydn-javascript] DataTable with Varying Types in a Given Column?


        > Hi,
        >
        > I am working toward using DataTable to implement a configuration
        > settings viewer and editor (using in-line editing) in which the
        > settings' value column (the editable one) holds values of varying
        > types, including booleans (displayed as "yes" / "no"), strings and
        > numbers (both integers and floats). I'm conveying the information to
        > the page in JSON and use proper native JavaScript types for each
        > individual value.
        >
        > Satyam's DataTable tutorial blog (part 1) suggests that each column must
        > contain type-homogeneous data, insofar as it uses a fixed schema across
        > all rows in a given table.
        >
        > Is this just a special, simpler case? Is it possible to have more than
        > one kind of data in a given column? If so, what's required to achieve
        > it? In particular, can cell editors be assigned to individual cells
        > rather than to all the cells in a column?
        >
        > If row-varying cell types are impossible (or particularly difficult),
        > I'll have to rethink how to implement the settings editor.
        >
        >
        > Thanks.
        >
        > Randall Schulz
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        > --
        > No virus found in this incoming message.
        > Checked by AVG Free Edition.
        > Version: 7.5.503 / Virus Database: 269.16.12/1163 - Release Date:
        > 01/12/2007 12:05
        >
        >
      • Randall R Schulz
        ... I can t seem to find DataGrid on the YUI page. The only use of grid on the home page relates to the CSS grids. The API document search produces no hits
        Message 3 of 12 , Dec 2, 2007
        • 0 Attachment
          On Sunday 02 December 2007 13:57, Satyam wrote:
          > The DataTable is basically meant to be the visual representation of a
          > database table with its normal columns and records. Data type
          > information is not stored on a cell per cell basis but there is only
          > one columns definition array which stores a single definition per
          > column of data for all the records. What you are looking for is a
          > DataGrid where there is no such structure as a database table usually
          > has.

          I can't seem to find DataGrid on the YUI page. The only use of "grid" on
          the home page relates to the CSS grids. The API document search
          produces no hits for "grid" Where is it?

          I gather this DataGrid is hypothetical?


          > ...
          >
          > Satyam


          Randall Schulz
        • Satyam
          There is no such component in YUI, I just used the term to differentiate a DataTable, which exists, from what you want, which does not. Sorry about the
          Message 4 of 12 , Dec 3, 2007
          • 0 Attachment
            There is no such component in YUI, I just used the term to differentiate a
            DataTable, which exists, from what you want, which does not. Sorry about
            the confusion.

            Satyam



            ----- Original Message -----
            From: "Randall R Schulz" <rschulz@...>
            To: <ydn-javascript@yahoogroups.com>
            Sent: Monday, December 03, 2007 12:17 AM
            Subject: Re: [ydn-javascript] DataTable with Varying Types in a Given
            Column?


            > On Sunday 02 December 2007 13:57, Satyam wrote:
            >> The DataTable is basically meant to be the visual representation of a
            >> database table with its normal columns and records. Data type
            >> information is not stored on a cell per cell basis but there is only
            >> one columns definition array which stores a single definition per
            >> column of data for all the records. What you are looking for is a
            >> DataGrid where there is no such structure as a database table usually
            >> has.
            >
            > I can't seem to find DataGrid on the YUI page. The only use of "grid" on
            > the home page relates to the CSS grids. The API document search
            > produces no hits for "grid" Where is it?
            >
            > I gather this DataGrid is hypothetical?
            >
            >
            >> ...
            >>
            >> Satyam
            >
            >
            > Randall Schulz
            >
            >
            >
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
            > --
            > No virus found in this incoming message.
            > Checked by AVG Free Edition.
            > Version: 7.5.503 / Virus Database: 269.16.13/1165 - Release Date:
            > 02/12/2007 20:34
            >
            >
          • Randall R Schulz
            ... OK. So my use case is a bit at odds with this, but it s not so far off that I don t think it can be made to work, give what you say below. ... I think this
            Message 5 of 12 , Dec 3, 2007
            • 0 Attachment
              On Sunday 02 December 2007 13:57, Satyam wrote:
              > The DataTable is basically meant to be the visual representation of a
              > database table with its normal columns and records.

              OK. So my use case is a bit at odds with this, but it's not so far off
              that I don't think it can be made to work, give what you say below.


              > ...
              >
              > You could define a generic formatter and editor for all of the
              > columns which might branch of to the different cell formatters and
              > editors depending on the column and the record. ...
              >
              > Like:
              >
              > myColumnDefs = [
              > {key:'col1',formatter:this.myFormatterDispatcher,
              > editor:this.myEditorDispatcher, ...
              >
              > Both your dispatchers would have to have the argument signature of
              > the regular formatter and editor:
              >
              > this.myFormatterDispatcher = function(elCell, oRecord, oColumn,oData)
              > this.myEditorDispatcher = function(oEditor, oSelf)
              >
              > Both have information both from the column and all the fields in the
              > record, both visible and hidden, and can call the corresponding
              > method passing it the very same arguments it has received.

              I think this should be a workable technique for my purposes. I'll give
              it a try.


              > Satyam


              Thank you.

              Randall Schulz
            • Satyam
              You might want to check: http://satyam.com.ar/int/yui/DataGrid.html I can t say if this is what you are looking for but at least it breaks the rule of one
              Message 6 of 12 , Dec 4, 2007
              • 0 Attachment
                You might want to check:

                http://satyam.com.ar/int/yui/DataGrid.html

                I can't say if this is what you are looking for but at least it breaks the
                rule of one datatype per column.

                Satyam

                ----- Original Message -----
                From: "Randall R Schulz" <rschulz@...>
                To: <ydn-javascript@yahoogroups.com>
                Sent: Monday, December 03, 2007 10:58 PM
                Subject: Re: [ydn-javascript] DataTable with Varying Types in a Given
                Column?


                > On Sunday 02 December 2007 13:57, Satyam wrote:
                >> The DataTable is basically meant to be the visual representation of a
                >> database table with its normal columns and records.
                >
                > OK. So my use case is a bit at odds with this, but it's not so far off
                > that I don't think it can be made to work, give what you say below.
                >
                >
                >> ...
                >>
                >> You could define a generic formatter and editor for all of the
                >> columns which might branch of to the different cell formatters and
                >> editors depending on the column and the record. ...
                >>
                >> Like:
                >>
                >> myColumnDefs = [
                >> {key:'col1',formatter:this.myFormatterDispatcher,
                >> editor:this.myEditorDispatcher, ...
                >>
                >> Both your dispatchers would have to have the argument signature of
                >> the regular formatter and editor:
                >>
                >> this.myFormatterDispatcher = function(elCell, oRecord, oColumn,oData)
                >> this.myEditorDispatcher = function(oEditor, oSelf)
                >>
                >> Both have information both from the column and all the fields in the
                >> record, both visible and hidden, and can call the corresponding
                >> method passing it the very same arguments it has received.
                >
                > I think this should be a workable technique for my purposes. I'll give
                > it a try.
                >
                >
                >> Satyam
                >
                >
                > Thank you.
                >
                > Randall Schulz
                >
                >
                >
                > Yahoo! Groups Links
                >
                >
                >
                >
                >
                > --
                > No virus found in this incoming message.
                > Checked by AVG Free Edition.
                > Version: 7.5.503 / Virus Database: 269.16.13/1165 - Release Date:
                > 02/12/2007 20:34
                >
                >
              • Randall R Schulz
                ... Thanks again. Between this and your previous reply, I think I ve got all the information I need to get the results I want. ... Randall Schulz
                Message 7 of 12 , Dec 4, 2007
                • 0 Attachment
                  On Tuesday 04 December 2007 07:13, Satyam wrote:
                  > You might want to check:
                  >
                  > http://satyam.com.ar/int/yui/DataGrid.html
                  >
                  > I can't say if this is what you are looking for but at least it
                  > breaks the rule of one datatype per column.

                  Thanks again.

                  Between this and your previous reply, I think I've got all the
                  information I need to get the results I want.


                  > Satyam


                  Randall Schulz
                • Randall R Schulz
                  ... I do have one follow-up question (so far). When I apply the pattern I see in your DataGrid example (which includes only text and Calendar input):
                  Message 8 of 12 , Dec 4, 2007
                  • 0 Attachment
                    On Tuesday 04 December 2007 07:13, Satyam wrote:
                    > You might want to check:
                    >
                    > http://satyam.com.ar/int/yui/DataGrid.html
                    >
                    > I can't say if this is what you are looking for but at least it
                    > breaks the rule of one datatype per column.

                    I do have one follow-up question (so far). When I apply the pattern I
                    see in your DataGrid example (which includes only text and Calendar
                    input):

                    YAHOO.widget.DataTable.editTextbox.call(oSelf, oEditor, oSelf);

                    ... to radio buttons:

                    YAHOO.widget.DataTable.editRadio.call(oSelf, oEditor, oSelf);

                    ... I end up with a radio-button editor that has only "OK" and "Cancel"
                    buttons.

                    What must be done to control / populate the list of radio-button
                    alternatives presented when activating the radio-button editor?


                    > Satyam


                    Randall Schulz
                  • Randall R Schulz
                    ... I think I figured it out. I added this: editorOptions: { radioOptions:[ yes , no ] } to the column definition object literal for the editable value
                    Message 9 of 12 , Dec 4, 2007
                    • 0 Attachment
                      On Tuesday 04 December 2007 16:19, Randall R Schulz wrote:
                      > On Tuesday 04 December 2007 07:13, Satyam wrote:
                      > > You might want to check:
                      > >
                      > > http://satyam.com.ar/int/yui/DataGrid.html
                      > >
                      > > I can't say if this is what you are looking for but at least it
                      > > breaks the rule of one datatype per column.
                      >
                      > I do have one follow-up question (so far). When I apply the pattern I
                      > see in your DataGrid example (which includes only text and Calendar
                      > input) ... to radio buttons ... I end up with a radio-button editor
                      > that has only "OK" and "Cancel" buttons.
                      >
                      > What must be done to control / populate the list of radio-button
                      > alternatives presented when activating the radio-button editor?

                      I think I figured it out. I added this:

                      editorOptions: { radioOptions:["yes", "no"] }

                      to the column definition object literal for the editable value column.

                      This is sufficient because all the radio buttons in the column have the
                      same complement of allowable values ("yes" or "no", obviously) and the
                      radioOptions array does not interfere with other editors when they're
                      activated for that column.


                      What would I have to do to have different sets of values on some rows?


                      Randall Schulz
                    • Satyam
                      I added radio buttons to the example, see the bottom right cell. Now it is located at: http://www.satyam.com.ar/yui/DataGrid.html Notice that the formatRadio
                      Message 10 of 12 , Dec 5, 2007
                      • 0 Attachment
                        I added radio buttons to the example, see the bottom right cell. Now it is
                        located at:

                        http://www.satyam.com.ar/yui/DataGrid.html


                        Notice that the formatRadio and the editRadio methods don't work with each
                        other. The formatRadio is meant to have one radio selected out of the whole
                        column, the editRadio expects you to select amongst several radios on the
                        same cell. The naming is quite confusing. Same thing with Checkboxes.


                        Satyam


                        ----- Original Message -----
                        From: "Randall R Schulz" <rschulz@...>
                        To: <ydn-javascript@yahoogroups.com>
                        Sent: Wednesday, December 05, 2007 1:19 AM
                        Subject: Re: [ydn-javascript] DataTable with Varying Types in a Given
                        Column?


                        > On Tuesday 04 December 2007 07:13, Satyam wrote:
                        >> You might want to check:
                        >>
                        >> http://satyam.com.ar/int/yui/DataGrid.html
                        >>
                        >> I can't say if this is what you are looking for but at least it
                        >> breaks the rule of one datatype per column.
                        >
                        > I do have one follow-up question (so far). When I apply the pattern I
                        > see in your DataGrid example (which includes only text and Calendar
                        > input):
                        >
                        > YAHOO.widget.DataTable.editTextbox.call(oSelf, oEditor, oSelf);
                        >
                        > ... to radio buttons:
                        >
                        > YAHOO.widget.DataTable.editRadio.call(oSelf, oEditor, oSelf);
                        >
                        > ... I end up with a radio-button editor that has only "OK" and "Cancel"
                        > buttons.
                        >
                        > What must be done to control / populate the list of radio-button
                        > alternatives presented when activating the radio-button editor?
                        >
                        >
                        >> Satyam
                        >
                        >
                        > Randall Schulz
                        >
                        >
                        >
                        > Yahoo! Groups Links
                        >
                        >
                        >
                        >
                        >
                        > --
                        > No virus found in this incoming message.
                        > Checked by AVG Free Edition.
                        > Version: 7.5.503 / Virus Database: 269.16.14/1171 - Release Date:
                        > 04/12/2007 19:31
                        >
                        >
                      • Randall R Schulz
                        ... Thank you again. It s very kind of you to take so much time with this. I think I ve got the basic level of functionality I require right now. Randall
                        Message 11 of 12 , Dec 5, 2007
                        • 0 Attachment
                          On Wednesday 05 December 2007 01:19, Satyam wrote:
                          > I added radio buttons to the example, see the bottom right cell. Now
                          > it is located at:
                          >
                          > http://www.satyam.com.ar/yui/DataGrid.html
                          >
                          >
                          > Notice that the formatRadio and the editRadio methods don't work with
                          > each other. The formatRadio is meant to have one radio selected out
                          > of the whole column, the editRadio expects you to select amongst
                          > several radios on the same cell. The naming is quite confusing.
                          > Same thing with Checkboxes.
                          >
                          >
                          > Satyam

                          Thank you again. It's very kind of you to take so much time with this.

                          I think I've got the basic level of functionality I require right now.


                          Randall Schulz
                        • Satyam
                          No problem at all, I was thinking about this issue some time ago so you gave me the excuse to try it out. Satyam ... From: Randall R Schulz
                          Message 12 of 12 , Dec 5, 2007
                          • 0 Attachment
                            No problem at all, I was thinking about this issue some time ago so you gave
                            me the excuse to try it out.

                            Satyam

                            ----- Original Message -----
                            From: "Randall R Schulz" <rschulz@...>
                            To: <ydn-javascript@yahoogroups.com>
                            Sent: Wednesday, December 05, 2007 3:42 PM
                            Subject: Re: [ydn-javascript] DataTable with Varying Types in a Given
                            Column?


                            > On Wednesday 05 December 2007 01:19, Satyam wrote:
                            >> I added radio buttons to the example, see the bottom right cell. Now
                            >> it is located at:
                            >>
                            >> http://www.satyam.com.ar/yui/DataGrid.html
                            >>
                            >>
                            >> Notice that the formatRadio and the editRadio methods don't work with
                            >> each other. The formatRadio is meant to have one radio selected out
                            >> of the whole column, the editRadio expects you to select amongst
                            >> several radios on the same cell. The naming is quite confusing.
                            >> Same thing with Checkboxes.
                            >>
                            >>
                            >> Satyam
                            >
                            > Thank you again. It's very kind of you to take so much time with this.
                            >
                            > I think I've got the basic level of functionality I require right now.
                            >
                            >
                            > Randall Schulz
                            >
                            >
                            >
                            > Yahoo! Groups Links
                            >
                            >
                            >
                            >
                            >
                            > --
                            > No virus found in this incoming message.
                            > Checked by AVG Free Edition.
                            > Version: 7.5.503 / Virus Database: 269.16.14/1171 - Release Date:
                            > 04/12/2007 19:31
                            >
                            >
                          Your message has been successfully submitted and would be delivered to recipients shortly.