Hi Team,
I have template formatting for one of the columns in the grid which renders data depending on the condition. When I am trying to export that grid to excel, the conditional formatted data is not showing up in excel.
Please find below the example in which second row under "Location Name" column is coming empty from backend, but is being rendered as "No Location". But if this grid is exported into excel, the Location Name on second row appears as empty, not as "No Location".
https://jsfiddle.net/n9360zdu/1/
Can you please let me know the fix?
Regards,
Vaibhav
Hello Vaibhav,
After investigating this further, I have determined that in order to display “No Location” when the grid is exported to Excel, a formatter function should be used for this column. However, the link for the column, if there is a value should still be templated. Using a formatter function and a template for a column could be achieved as follows:
{
headerText: "Location Name",
. . .
formatter: function(val, record) {return (val === '')? "No Location" : val ;},
template: "{{if \$\{locationName\} !== 'No Location' }} <a href='/capadm/location/show?id=\$\{locationId\}'>\$\{locationName\}</a> {{else}} \$\{locationName\} {{/if}}"
},
I have modified the shared sample, in order to demonstrate the described behavior. Please test it on your side and let me know if you need any further information regarding this matter.
Regards, Monika Kirkova, Infragistics
Thank you so much Monika! That resolved my issue.