DataTables only for exporting?

DataTables only for exporting?

albertjalbertj Posts: 2Questions: 1Answers: 0

Hi,
I need to export content of the table, but it I've created my unique mechanics how it behaves, and don't want to use the DataTables for any visual changes - just need its export features.

If it's impossible to display just export buttons and not change anything with table look, maybe it's possible to generate second table with buttons where table frame would be hidden, so I could use that what is interesting me?

Thanks

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    Two options:

    1. Disable the DataTables features you don't want - e.g. paging, search and order. Just initialise Buttons and the export buttons on it.
    2. You could use the Buttons code (it is open source) and rig it so you can pass in data. It would require a fair bit of hacking, but it would be a better option if you don't need DataTables core (since you would then be saving on bandwidth).

    Allan

  • albertjalbertj Posts: 2Questions: 1Answers: 0

    Thanks for quick reply.
    I have some input fields in the cells (like text areas, date input), and I have there also some active DIVs that are clickable and are changing their CSS parameters (called from functions). I have to check if option 1 will not break any of those.
    In terms of option 2 - probably it would be easier to write own export to excel function than implement that one.
    I'm trying to use DataTables to be consequent - I'm using it for some other tables on that page, so would prefer to do export exactly the same way.
    If it's not possible, will have to use other solution.

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin

    I have to check if option 1 will not break any of those.

    I don't know I'm afraid. I'd need a link to a page showing the issue. It might be that you would need to change some operations, but then again, it might continue to just work, depending on what you are doing. I'd suggest that if you try it, make sure you Initialise all your event handlers first, and then initialise the DataTable.

    Allan

Sign In or Register to comment.