Why state saving doesn't work for columns visibility only? - Page 2

Why state saving doesn't work for columns visibility only?

2»

Answers

  • lodmikulodmiku Posts: 25Questions: 2Answers: 1

    I still can't figure out why child rows aren't behave like regular rows. If there's a walkaroud could you please direct me in the right direction? Cheers

  • allanallan Posts: 63,201Questions: 1Answers: 10,414 Site admin

    Thanks for the link - I didn't know that you were using child rows. The issue is that you need to take account of the column visibility and also the column reordering in your child rows. The easiest way will probably be to re-create the child row when the column-reorder or the column-visibility events occur. You'll need to account for the new column order and the fact that there might be less columns shown.

    Allan

  • lodmikulodmiku Posts: 25Questions: 2Answers: 1

    Should I store a modified index of reordered and visible columns? No idea how to reformat child row. Is there a corresponding example ?

  • lodmikulodmiku Posts: 25Questions: 2Answers: 1
    edited November 2015

    Hi Allan. I had to give up on child rows idea, as you mentioned before child rows can not be exported to excel and that is something I actually need.

    Table data contains items with their past versions which should be hidden at first. So I thought that maybe I could first filter all table data just before loading it into datatable. I'd add filter to data in hidden column "versions", so that only current versions for all items are shown when dt loads.

    In separate column I'd add a button (like"plus" button from child rows demo) and when user clicks on that button I'd filter data so only all versions of that particular item are visible and the rest of items is hidden, in that situation export to excel should work for that particular item versions.

    And later clicking on "minus" button (which replaced "plus" button), I would reset filter back to show current versions of all items.

    What do think about it? Is it possible to achieve such functionality? Could you point me to right direction? And I found that filter in API is similar to search - which should I use? Thanks

  • allanallan Posts: 63,201Questions: 1Answers: 10,414 Site admin

    The search() and column().search() method could be used to perform the search. For more complex search commands you might need to use a custom filtering plug-in.

    Allan

  • lodmikulodmiku Posts: 25Questions: 2Answers: 1

    Thank you. I ended up using: "searchCols": [ { "search": "current" } ]
    for first column to flter data before loading datatable. But what's happening now is that I'm not able to search through "base" data, meaning "data existing before first filter". Am I doing something the wrong way? Thanks

  • lodmikulodmiku Posts: 25Questions: 2Answers: 1
    Answer ✓

    Ok, I figured it out. Just had to clear previous filter first. I'm still custimizing datatable for my project, but I tell you this: Your datatable plugin is great. Thanks

This discussion has been closed.