pdf export
pdf export
andrii.radkovskii
Posts: 20Questions: 0Answers: 0
Hi everyone, help please modify the code.
How to make it so when exporting to PDF, when in the column "Office" there is the word "London" it was painted in blue.
I finde an example with a value but not with a word. Thank you.
This discussion has been closed.
Replies
Ha, that example was one of mine from a different thread, the change is trivial, see here.
Thank you very much!
Hi @colin, I used your code, but when I use search and clicked on button PDF Export I having Error. Maybe you will help me please?
This your code live.datatables.net/tihoyuqa/1/edit
And error image
Did you include all the sources? See the HTML tab on that example you posted, you need all those files in your configuration too.
@colin
I have connected all the files, all the same makes a mistake.
Are you sure you're accessing http://live.datatables.net/tihoyuqa/1/edit ?
That works without error for me...
@colin
I went through the reference you gave, entered the word London in the Search box and received an error when exporting.
Chrome
https://imgur.com/a/cPUBhfQ
Mozilla
https://imgur.com/a/m2C6ZSa
The problem is that this line is retrieving all the data in column 2, not just the filtered data:
var office = table.column(2).data().toArray();
You need to include
selector-modifier
of{search: 'applied'}
to retrieve on the filtered data. See the updated example:http://live.datatables.net/gidariwo/1/edit
Kevin
Gotcha, sorry, it was because you were filtering - the code wasn't taking that into account. See updated example here.
C
@colin @kthorngren Thank you very much! Everything works perfectly.