Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid export and field titles with localized ds

    I have a ListGrids thatare exported to CSV and Excel formats. When a ListGrid uses a DataSource from a ds.xml that has field titles localized by using jsp and fmt.tld, it puts the whole string between the <title></title> rather than the localized title (or even the fmt:key or field name).

    The upshot is on the exports is column titles like "<fmt:message key="site_status_ds_phys_status" />" instead of "Physical status" or "phys_status", for this field:

    Code:
    		<field name="phys_status" type="number" align="center">
    			<title>
    				<fmt:message key="site_status_ds_phys_status" />
    			</title>
    		</field>
    I was expecting the localized field title or the field name.

    I'm using SC_SNAPSHOT-2011-04-05/PowerEdition Deployment (built 2011-04-05).

    #2
    You can use the client-side API dsRequest.setExportFields() to get the localized field titles from the ListGrid or DataSource and pass them to the server.

    Sorry about the inconvenience here, we'll look for a way to make this automatic in the future.
    Last edited by Isomorphic; 6 Apr 2011, 17:07.

    Comment


      #3
      Actually, that's not going to completely work. We think we can make a framework change instead that will obviate the need for extra API calls - stay tuned.

      Comment


        #4
        We've made a framework change so that the localized titles that the user is seeing in the browser are automatically transmitted to the server for use in export. Please try this out in the next nightly build and confirm it solves the problem for you.

        Comment


          #5
          The framework works well for Excel exports, but export to CSV isn't quite right due to extra whitespace around the field titles. Here's a snippet from the request:
          Code:
              exportResults:true,
              exportAs:"csv",
              exportDelimiter:",",
              exportTitleSeparatorChar:null,
              exportFilename:"Results.csv",
              exportDisplay:"download",
              lineBreakStyle:"default",
              exportFields:[
                  "hq_name",
                  "broadcast_date",
                  "machine_name",
                  "zone_name",
                  "network_name",
                  "last_import_date",
                  "last_export_date"
              ],
              exportFieldTitles:{
                  hq_name:"\n				HQ\n			",
                  broadcast_date:"\n				Broadcast Date\n			",
                  machine_name:"\n				HE\n			",
                  zone_name:"\n				Zone\n			",
                  network_name:"\n				Network\n			",
                  last_import_date:"\n				Last Import\n			",
                  last_export_date:"\n				Last Export\n			"
              },
          The CSV file returned has the following field headers:
          Code:
          "
          				HQ
          			","
          				Broadcast Date
          			","
          				HE
          			","
          				Zone
          			","
          				Network
          			","
          				Last Import
          			","
          				Last Export
          			"
          Could the field titles be trimmed of whitespace?

          I used SC_SNAPSHOT-2011-04-11/PowerEdition Deployment (built 2011-04-11) for this test.

          Comment


            #6
            This seems to indicate that your actual titles in your DataSource have this whitespace and it's just not showing up in a visible way in eg the ListGrid. If so, you should get the whitespace out of the titles in the DataSource because it will otherwise come up again.

            The whitespace could result from doing something like this in your .ds.xml files:

            Code:
            <title>
                <someJspTag with="attributes"/>
            </title>
            If so, reformat to:

            Code:
            <title><someJspTag with="attributes"/></title>

            Comment


              #7
              Ahh, thank you. This was indeed the case. Works great. Thanks for the change.

              Comment

              Working...
              X