hhurz / tableExport.jquery.plugin

jQuery plugin to export a html table to JSON, XML, CSV, TSV, TXT, SQL, Word, Excel, PNG and PDF
MIT License
984 stars 714 forks source link

data-tableexport-display="none" with bootstrap table not working #280

Closed kschrade78 closed 4 years ago

kschrade78 commented 4 years ago

I am attempting to prevent some columns from a bootstrap 1.11.1 table from appearing in the export by using the data-tableexport-display="none" on the column headers and the data cells. The headers () are still appearing in the export, but the data cells are not there making it so that the data is all off by the number of columns that I am attempting to remove.

After stepping though the code, I feel the problem is related to the fact that I am using bootstrap table in combination with tableExport. In the IsVisible function, where it is attempting to determine if the data-tableexport-display attribute is on the tag, it is using the jquery attr() function. This is coming back undefined on the column headers. I think that when using bootstrap, it is interpreting the data attributes making them unavailable for attr() and making it so the data() function needs to be used in order to determine if the tableexportDisplay value is available and its value.

The work around I was able to use was to use the ignoreColumn attribute as part of the exportOptions within the bootstrap table setup.

hhurz commented 4 years ago

Thanks for sharing your work around. How did you add the data-tableexport-display attribute to the bootstrap table? For further investigation some sample code would be very helpfull.