Export to excel not working for multiple excel downloads
Export to excel not working for multiple excel downloads

I am looking to create multiple excel files on a single click. It seems to be working for a single column but I am looking to do it while exporting the data from 3 columns with or condition.
Here is the link for my example
http://live.datatables.net/jipucijo/1/edit
I have set the data in the above example based on the "System Architect" position which lies in position 1, position 2 and position 3. What I am trying to do is to make use of the OR condition where if "System Architect" lies in either of the 3 columns (position 1, position 2 and position 3), to export all the data from these columns where the value lies.
Answers
Here is my working example for one column which does multiple downloads.
http://live.datatables.net/guhowefo/1/edit
Just a quick glance you have this:
The variable
column
will only contain the API for column 2. If you wantcolumn
to contain all 3 columns then trycolumn = dt.columns( [0,1,2] );
. Not sure if this will give the results you want but you can try it.Kevin
Hi @kthorngren ,
I did the way you suggest but the create excel button is still not working.
Here is the link to my example
http://live.datatables.net/mesopacu/1/edit
You have a syntax error. Try changing
dt.cells(null, 0,1,2, {
todt.cells(null, [0,1,2], {
. This will make 1,2,3 and array.Kevin
@kthorngren ,
Thanks I got it right now and the create to excel button is working. However its returning empty files now with no data. I think what it's doing is it's returning the values from columns 0,1,2 while using AND search. I am looking to use OR search so that it returns all values.
Here is the link to my example now:
http://live.datatables.net/mesopacu/2/edit
@kthorngren ,
Please see the example below:
http://live.datatables.net/gituqahe/1/edit
I have tried to do it by different ways but still not able to get the data still getting the empty file. Your response is highly appreciated.
Thanks
You will probably need to create a search plugin to handle the OR searches across multiple columns. I don't have a specific example for what you are doing but do have a couple you can start from.
My first suggestion is to use a global variable as a flag to determine if the plugin should run. Set the flag true if the button is clicked. Otherwise for normal searches set the flag false. Basically in your button's action function you will have the following steps:
dt.draw()
to run the search pluginexcelHtml5.action.call
dt.draw()
to revert the table back to what the use expects to seeHere is an example of using the flag:
http://live.datatables.net/yisaqore/1/edit
Just replace this code with an if that checks the flag:
This is a example of using an OR search across columns:
http://live.datatables.net/mucevape/1/edit
Hope this helps.
Kevin