Hi,
I hope you can help me once again. In my application, i allow users to configure the grid by hiding and reordering columns. I built my own dialog for user-interaction and afterwards i set up the grid programmatically.
Hiding is done with "$('#grid').igGrid('hideColumn', columnKey);" (and unhiding of course the same way with "showColumn").
To reorder the columns "$('#grid').igGridColumnMoving('moveColumn', columnKey, index);". Assuming i'm having 10 columns, i run though them all from the end and move them to index 0.
Hiding and moving works fine, but once i try to unhide a column, i'm getting an error ("property "start" of undefined or nullreference not found"). A workaround is setting all columns visible before moving them, but that seems a little bit dirty to me.
I'm currently on the latest version i guess (13.2.20132.2012), it would be nice if you could take a look into that.
Thanks in advance
Lorenz
Hello Lorenz,
I am still trying to reproduce your issue and if I do I'll certainly log it so it receives attention. However, I think such column rearrangement combined with showing and hiding columns to match a separate column control's state is best done with destroying and recreating the grid with a new column collection in the appropriate order and with "hidden" properties appropriately set for each column. Your solution, even without having to show all columns before moving them, will be multiple times slower than simply re-rendering it due to the hefty amount of DOM manipulation involved. This is also why ColumnMoving does not have UI or an API method that allows for supplying a new random arrangement of the columns as input.
I'll let you know when I manage to reproduce the issue. Thank you for using Infragistics forums!
Best regards,
Stamen Stoychev
Hi Stamen,
thank you very much for looking at it and also for the tip to recreate the grid. I will try this out and compare both solutions.
Best regards
thanks for looking at it. But i guess i'll stick with your first suggestion of completly recreating the grid. It works really fine, it's fast and i also think it's the "cleanest" way of handling my application, as you mentioned before.
Thanks again!
Regards
After looking into your solution I think the main issue with it is that both the moving and the hiding operations are asynchronous and pass control to your function to execute a new operation before the previous one is completely finished. I think you can still go for it but you'll need some mechanism to check if the grid doesn't run a moving or hiding operation before executing the next on the list. Something like checking whether the loading indicator is visible should work. I can prepare a small sample demonstrating such an approach if you prefer it over my previous suggestion of recreating the grid.