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

Merge columns?

Expand Messages
  • Zac Tolley
    I have a table I m building and want to display address details. Now, the database and my xml query return the address as a number of distinct fields, but the
    Message 1 of 2 , Dec 30, 2007
    • 0 Attachment
      I have a table I'm building and want to display address details. Now,
      the database and my xml query return the address as a number of
      distinct fields, but the resulting table looks pretty dire.

      I want to take the data source and merge the address fields into 1
      field to make it look nicer.

      Can I join fields using the formatter stuff or would i be best off
      just changing the source data?
    • Satyam
      The formatter is quite capable of doing what you want. You need to declare all the individual fields in the DataSource so that all of them get read but you
      Message 2 of 2 , Dec 30, 2007
      • 0 Attachment
        The formatter is quite capable of doing what you want. You need to declare
        all the individual fields in the DataSource so that all of them get read but
        you don't declare them all in the column definitions of the DataTable, for
        the addresses, you simply declare a single column, if you want to display it
        that way. The key of that field does not need to be related to any of the
        fields in the DataSource, it can be related to one of them, but there is no
        need. In the formatter, amongst other arguments, you'll get a reference to
        the cell, which you are free to fill however you want, and a reference to
        the record containing all the fields read by the DataSource, whether they
        are lsited in the column definitions or not. With method getData() of the
        Record object, you can pick any field from that record. If the column key
        name corresponds to any of the field names of the DataSource, the value for
        that field will be available in the oData argument, otherwise, you just pick
        them all from the Record object. If you plan to use sorting, the field
        containing the multiple parts of the address will get sorted by the value of
        the field in the DataSource it is related to, you won't be able to sort that
        column by any other piece of data.

        Satyam

        ----- Original Message -----
        From: "Zac Tolley" <zac@...>
        To: <ydn-javascript@yahoogroups.com>
        Sent: Sunday, December 30, 2007 1:36 PM
        Subject: [ydn-javascript] Merge columns?


        >I have a table I'm building and want to display address details. Now,
        > the database and my xml query return the address as a number of
        > distinct fields, but the resulting table looks pretty dire.
        >
        > I want to take the data source and merge the address fields into 1
        > field to make it look nicer.
        >
        > Can I join fields using the formatter stuff or would i be best off
        > just changing the source data?
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        > --
        > No virus found in this incoming message.
        > Checked by AVG Free Edition.
        > Version: 7.5.516 / Virus Database: 269.17.12/1202 - Release Date:
        > 29/12/2007 13:27
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.