I have a ultragrid embedded in a control and I need to persist the column sizes. The problem is "AfterColPosChanged" is called on control load event and on actual resizing, so the change was reverted on control reload. What I need to do is to load the grid sizes if it's a control reload, and save the sizes if it's an actual resizing. How do I do this? Thanks.
Okay. I still don't think it makes a lot of sense to save the positions inside AfterColPosChanged. You will just be saving and re-saving the same data and overwriting it far more often than necessary.
But if that's what you want to do then there are any number of ways you could deal with this.
1) Don't hook the event until after you Init method has completed.
2) Use the grid's EventManager to disable the event while the Init method is in progress.
3) Set a flag inside the Init method and check that flag inside the AfterColPosChanged handler.
I have a init method that loads everything on the control including the grid, and the afterColPosChanged is called every time in the init method. I don't know if this is expected behavior. I need to make the distinction between form load and column resize.
Hi,
I'm not sure I understand what you are asking.
What I would do is use the Save and Load methods on the grid's DisplayLayout. Save when the dialog closes and load when it opens. There's no reason to save every time the user makes a change.