Author Topic: exportData  (Read 3071 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
exportData
« on: June 17, 2016, 03:42:09 pm »
Hi

When using exportData function, I get the rendered html code for the field.

Ex:
Code: [Select]
render: function (ui) {
                   
           return "<span>"+ ui.cellData +"</span>";
           }

Will in export be <span>value</span>...I only want to get the value...

Is this possible?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: exportData
« Reply #1 on: June 17, 2016, 06:51:06 pm »
There are many ways to do that. Few of them:

Pass render: false to exportData() method

or

add exportRender: false to the column.
http://paramquery.com/pro/api#option-column-exportRender

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: exportData
« Reply #2 on: June 17, 2016, 07:03:37 pm »
Great, thanks.
I assume its not possible to use render: false and still have the percentage sign written out in the export, or is there another way to do it?

Code: [Select]
render: function (ui) {
                   
           return "<span>"+ ui.cellData +"%</span>";
           }

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: exportData
« Reply #3 on: June 17, 2016, 08:29:03 pm »
There is Export property available in column.render callback which can be used:

Code: [Select]
render: function (ui) {                   
  if( ui.Export ){
     return ui.cellData +"%";
  }
  else{
     return "<span>"+ ui.cellData +"%</span>";
  }

http://paramquery.com/pro/api#option-column-render

In this case, render: true should be passed to exportData()
« Last Edit: June 17, 2016, 08:31:02 pm by paramquery »