How to export for all values in a column filter?

How to export for all values in a column filter?

minhalminhal Posts: 76Questions: 12Answers: 0

I am looking to export for all the existing values in my column filter. The code works perfectly for a selected column filter and it can be exported for the selected column filter value but what I need is to download all at once and to get different export files for all the existing values in the column filter.
Here is an example where it works for a single column filter
http://live.datatables.net/viqoduxi/1/edit

Answers

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    This example shows how to use row selector-modifier to export the desired rows.

    Kevin

  • minhalminhal Posts: 76Questions: 12Answers: 0

    Hi @kthorngren ,

    Thanks for your reply, However I am not looking for the rows. I am looking export for all the files which are available in the filter. Like in this example http://live.datatables.net/viqoduxi/1/edit where you can see that you get all the values for position in the position filter. So I am looking to export individual files for all those values but all at once.

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Not sure I totally follow what you want. Are you saying that you want to click an export button and have it create individual files for each unique value in a column? For example, there would be an "Accountant" file with all rows that have "Accountant", a "Software Engineer" file, etc. Is this accurate?

    Kevin

  • minhalminhal Posts: 76Questions: 12Answers: 0

    Yes that's exactly what I am trying to get here. I have been stuck on this for a week trying to figure out a way for that. I would really appreciate your help on that.

    Thanks

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    I would look at creating a Custom Button like this example. The buttons.buttons.action examples have code you can start with. I built a simple example from both links:
    http://live.datatables.net/naverati/1/edit

    You can take my example and expand upon it by creating an array of unique values and looping through those values to perform the search and run the desired export button.

    HTH,
    Kevin

  • minhalminhal Posts: 76Questions: 12Answers: 0

    @kthorngren ,

    Thank alot, That's exactly what I was trying to do. This is actually a great example to start with. Do you have any examples for arrays and looping so I can use them.

    Thanks again

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Use the code you have in initComplete to append to the options (column.data().unique().sort().each()). But instead use push() to push onto an array.

    Kevin

  • minhalminhal Posts: 76Questions: 12Answers: 0

    @kthorngren ,

    I am not so good at it but I am trying my best to put everything together and provide an example of my code if everything works out.

    Thanks

  • minhalminhal Posts: 76Questions: 12Answers: 0

    Hi @kthorngren ,

    I have been trying it from yesterday, But I am not able to tackle it. Can you please take a look over it and see where I am going wrong here. I would really appreciate that. here is the link to where I am till now http://live.datatables.net/qejacuzo/1/edit

    Thanks

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769
  • minhalminhal Posts: 76Questions: 12Answers: 0

    Hi @kthorngren ,

    You have been a great help. I can't thank you enough. Its exactly what I was looking for. I am now just stuck with a last thing which is that I needed the same OR condition for three columns in the same way like this example http://live.datatables.net/zarolake/1/edit

    So now I have altered some of the data in this example http://live.datatables.net/kefuguju/1/edit to have it the OR condition. (Like for this example if the data is present in position1, position2 and position 3 should all be picked up by the export for a individual export)

    It would be really great if you can help me out for this last thing as well.

    Thanks alot for all your help uptill now. Greatly appreciated.

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Is this what you are looking for?
    http://live.datatables.net/kihedose/1/edit

    I based this off an example Allan provided for updating the select inputs. It uses the cells().data() to find the values that are displayed after filtering the table with the inputs. Also note the added column.search(''); after the excel button is executed. This resets the column search back to "default".

    Kevin

  • minhalminhal Posts: 76Questions: 12Answers: 0

    Hi @kthorngren ,

    I have set the data in this example http://live.datatables.net/guhowefo/1/edit 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.

    Thanks for your help.

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    It would take quite a bit of time for me to workout an example. Maybe on of the developers can give you a quick example. If not you may be able use one of their support options to have something developed for you.

    Kevin

  • minhalminhal Posts: 76Questions: 12Answers: 0

    @kthorngren ,

    I really appreciate all your help. If you can do this that would be a great help, If you have time to do this in a few days or a week that would also work for me.

    Thanks

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Sorry, but I probably won't have time for another small project to do. If I thought it would be quick I would whip up an example but I think it will take a bit of time - at least in my case. Hope you find help with this.

    Kevin

  • minhalminhal Posts: 76Questions: 12Answers: 0

    No worries and thanks again for all your help.

    Thanks

  • minhalminhal Posts: 76Questions: 12Answers: 0

    @colin @Alan ,

    Can you guys help me out for this one. It would be a great help.

    Thanks

  • colincolin Posts: 15,143Questions: 1Answers: 2,586

    Hi @minhal ,

    Yep, happy to help. Please see the support options here.

    Cheers,

    Colin

  • minhalminhal Posts: 76Questions: 12Answers: 0

    Hi @colin ,

    I have everything up and running, its just about getting the OR condition in it which I can not figure out how to do it. It would be great if you can look into it.

    Here is the link for my example
    http://live.datatables.net/guhowefo/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.

This discussion has been closed.