file exporting when filters/search made on the table contents and also colors/headers
file exporting when filters/search made on the table contents and also colors/headers
umaeswara
Posts: 83Questions: 16Answers: 0
I see this example https://datatables.net/extensions/buttons/examples/initialisation/export.html. how to make it work when a filter is applied or search is made. after search made still it is exporting full table i would like if it can export only the results of search or filter. my table columns are filterable.
And also the table has rows in different color shades, how can we make sure the exported xlsheet also has same colors? is it possible?
thanks,
Uma-
This discussion has been closed.
Answers
By default, it will only export the filtered rows. This example from this thread shows how to export all rows.
For colours, see this example from this thread,
Colin
thanks Colin, this is really helpful.
btw, how do i insert other buttons here, like pdf,csv,copy etc.
At a glance that looks like it should do the trick - other examples here should also help if you are having problems.
If no joy, we're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
thanks Colin. sure, i will add example in my future queries.
btw, i am trying to minimizing the .js files i need to include on the webpage. i see these three are certainly needed for this excel button to be visible and work. do you agree or can I reduce it further ? i removed this jszip.min.js but then my button was not visible.
why do we need this jszip.min.js ?
here is the example: http://live.datatables.net/nudeyosa/1/edit
see it doesnt show "Excel" button if I comment out jszip.min.js .
why is that needed?
Oh I see, thanks for the test case. Yep, you need that file as it's used to construct the download file.
Colin
thanks colin, please check this testcase http://live.datatables.net/nudeyosa/1/edit
i want user to have a choice for choosing filename for the exported, right now i am giving the default name. can you please help me, if i can give a choice to user to give a name when they are about to save?
According to the
buttons.exportInfo()
docs you can set thetitle
with a function. Maybe that will work for your case.Kevin
Yep,
title
as Kevin said, example here: https://datatables.net/extensions/buttons/examples/html5/filename.htmlColin