Custom Views of Grid Columns #303
Replies: 2 comments 4 replies
-
It might be because you're using the same column definitions array without making a deep copy. The Grid Preset is only working at the grid creation lifecycle, it has no effect after the initialization of the grid, I added the It's a bit hard to help you without a repro, I added Stackblitz link to the main readme last week, so if you want to provide a repro, you can start using the Stackblitz template, that would be great. I would also like to mention again, in case you didn't know, that I'm not a React developer and this project was originally created by someone else and transferred to me later because I maintain all other SlickGrid repos. |
Beta Was this translation helpful? Give feedback.
-
I tried opening your stackblitz but it takes about 30 minutes (installing dependencies) for it to load. I have not used it before and not sure what to do with it next. I will read the docs. I will spend some time putting together a smaller demo to send you that is a much narrow focus of the issue. It just requires rewriting some code. I tried using hideColumnsByIds but it had the same issue changeColumnsArrangement did. It just loads all of the default columnDefinitions. I also tried using deepCopy but that did not fix the issue (I am changing the entire GridOptions when I change the view from the drop down). I also tried to use setColumns directly but that also did not work. I am not sure why updateFilters and updateSorting would work and not the hiding/unhiding of columns. Is there some other function call that I need to make to reload the grid after calling hideColumnsByIds or changeColumnsArrangement? I can only get this to work on the initial load of the grid. Right now to get it to work, after I pick the view from the drop down, then I set the value in a cookie and then use location.reload() to reload the page and then it works. This is not ideal as it takes longer for it to reload the page. I am hoping there are better options. Finally, I don't think this is a React issue. React is not wonderful, but it seems to be working as expected based on typical debugging techniques. I believe this would be an issue even if using vanilla JavaScript. Thanks for your help! |
Beta Was this translation helpful? Give feedback.
-
I am attempting to build in Custom Views in React very similar to your following example in universal.
https://github.com/ghiscoding/slickgrid-universal/blob/eaf3bfd8771944c325c870dcd42b1533bc77caed/examples/vite-demo-vanilla-bundle/src/examples/example11.ts#L717-L720
I have defined custom presets that I apply dynamically from a drop down with a preact signal. The presets are properly being set when I log to console the before and after of the column definitions. Sorting and Filtering are working as expected. However, it is showing all of the columns in the column definitions (147 total columns) instead of the columns in the preset. The filter and sorting are being properly applied but the visibility of the columns are not correct. Do you have any advice on what I am doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions