Author Topic: Remove HTML-Tags for export  (Read 2900 times)

Mendrace

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 12
    • View Profile
Remove HTML-Tags for export
« on: May 16, 2016, 12:04:49 am »
Hi.

My summaryData contains HTML tags. How can I prevent that these are displayed after exporting to Excel.

Example: <b>Total:</b>

Thanks

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Remove HTML-Tags for export
« Reply #1 on: May 16, 2016, 11:30:43 am »
Don't add html tags in the data, instead

1. add them in the render callback of the column.

2. add exportRender: false property to the column to prevent export of rendered values.

Example: http://paramquery.com/pro/demos/summary_json

Mendrace

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Remove HTML-Tags for export
« Reply #2 on: May 17, 2016, 12:43:27 am »
Thanks for the answer.

But there is one thing I don't understand.

The data for my colModel is loading dynamically and supplied as JSON. How can I give a rendering function for the column in the JSON-Data?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Remove HTML-Tags for export
« Reply #3 on: May 17, 2016, 02:25:31 pm »
Quote
The data for my colModel is loading dynamically and supplied as JSON. How can I give a rendering function for the column in the JSON-Data?

That's a valid point. For now it can be done by adding render property after loading colModel JSON data:

grid.getColumn( {dataIndx: 'dataIndx of your column' } ).render = render_callback_function;