Announcement

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

    exportClientData exporting escaped HTML value as empty string

    Hi Isomorphic,

    I am using a ListGridField with a custom cell formatter and escapeHTML set to false. The cell formatter escapes the value using StringUtil.asHTML. The value displays correctly in the list grid; however, it is exported as an empty string by exportClientData.

    According to the javadoc, this seems like it should work.

    Note that during export, the ListGridField.escapeHTML setting on a field determines how escaped and unescaped HTML values are handled. In particular, if escapeHTML is not set for a field, a value like "<FOO>" will be exported as the empty string, and you'd need the escaped value "&lt;FOO&gt;" to end up exporting "<FOO>".
    I'm using SmartClient Version: v12.1p_2023-10-21/Pro Deployment (built 2023-10-21).

    Note: if I temporarily set escapeHTML to true before calling exportClientData then it works as expected.

    Thanks
    Last edited by stonebranch3; Today, 07:04.

    #2
    Just to feed this back:

    1. you've got escapeHTML set to false on the field, and you are presumably producing HTML tags, and you expect those tags to be active (that is, <b> would produce bold styling, and the "<b>" would not be visible to the end user

    2. If the HTML was ignored, would you end up with the empty string?

    3. the export result that you want is to see the HTML tags - so for example, if this is a spreadsheet export, the cell should look like "<foo>" for example?

    If we're reading you correctly, then your approach of setting escapeHTML right before export seems to be correct. You want the HTML tags to be active in the grid, but you want the export to show the text of the tags themselves, right? That's what changing the setting on the fly would achieve.

    Comment

    Working...
    X