Unable to 'visible:false' columns that are not grouped with rowGroups.

Unable to 'visible:false' columns that are not grouped with rowGroups.

sharky98sharky98 Posts: 3Questions: 1Answers: 0

Hello,

I am using the rowGroup extension with multi-level grouping. Similar to this example https://datatables.net/extensions/rowgroup/examples/initialisation/multipleGroups.html . The two grouped columns are hidding without issues. However, when trying to hide other columns, for some reason (I have no error message anyway), they won't hide. I used the example with JSFiddle and it does work to hide other columns (https://jsfiddle.net/pnaw0fbj/ where it hides the column id 3).

In my code, I am also using AJAX with a callback processor, buttons, search builder extensions and I have 30 columns (I want to hide most of them, to be used only in the search builder). This is for a intranet page, so I can't show my exact code. If anybody has some idea where to look from where I am, I'd appreciate.

JSFiddles, all of them works and the last represent pretty closely what I have, except the data come from AJAX! That mean clearly something fail somewhere without any warning or error! :(
Base Example: https://jsfiddle.net/pnaw0fbj/
Adding Button: https://jsfiddle.net/pnaw0fbj/2/
Adding Search Builder: https://jsfiddle.net/pnaw0fbj/3/
More column count: https://jsfiddle.net/pnaw0fbj/4/
Even more column count : https://jsfiddle.net/pnaw0fbj/5/
Again even more column count: https://jsfiddle.net/pnaw0fbj/6/

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    I'm not clear what's not working, those examples appear to be doing what I'd expect. For my understanding, please could you post a single example, say what's happening, and also say what you'd expect to happen instead - that would help get it clear in my head.

    Colin

  • sharky98sharky98 Posts: 3Questions: 1Answers: 0

    After a night of sleep, it turns out that I had two issues. Both of them I can't really replicate on JSFiddle.
    1. I had SaveState and for some reason it was saving the hidding state, so even when I was refreshing CTRL+F5, it was returning me to my initial hidden column. Might be an issue when going in production though when column visibility changes and are not configurable by the client that they stay on the last config.
    2. For some reason, when skipping a column in the targets: [0, 1, 11], it did not register the 11, but did work on column 2 with targets: [0, 1, 2]. I was not able to replicate this on JSFiddle. I resolved by doing another entry in columnDefs and it worked.

    Weird bugs I had! Thanks anyway.

  • sharky98sharky98 Posts: 3Questions: 1Answers: 0

    So, it is not fully resolved. When I put back the "saveState" to true, I am going back to the initial behavior were some columns are not hidden. I am not able to clear my state.

    I've tried to do what was done there without result. In fact it doesn't clear the state and the destroy somehow prevent the re-initialization of the data.
    https://datatables.net/forums/discussion/24513/state-clear-is-not-working

    I had to include a duration on the state and wait that amount of time to make it work...

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    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

This discussion has been closed.