PDA

View Full Version : Persist column order in grid, during current session as well as in later sessions



rgraham
Apr 22, 2020, 1:14 AM
I see that there is a StateProvider="LocalStorage" attribute that can be added to the ResourceManager, this would amaze and delight my users if I could get it working to preserve the order of columns that they have arranged. Currently it always goes back to the "standard" order of columns we have hard-coded.

Once you have set this attribute in ResourceManager, how would you make sure it is saved whenever they make a change of column order? And then how to restore that column order the next time they open our web page? Also they use the Locked column feature, I would love to restore this.

If I could get this ability to persist the column order, I would be a super-hero!

Thanks in advance,

Bob Graham

fabricio.murta
Apr 22, 2020, 4:40 PM
Hello Bob!

You are probably doing something wrong, please provide a test case how you are trying to attain that.

In general lines, you should set the component's Stateful="true", and probably give the component an unique StateID="myComponentStateUniqueID", and also use the StateProvide="YourStateMechanismHere", as you pointed.

You may want to try using StateProvider="Cookie" to get it working how you want it to (as this won't require any server-side implementation to store the state); then try other methods as you get the hang of it.

It should store columns' position, among other settings. Just tried with the GridPanel > ArrayGrid > Simple example (https://examples5.ext.net/#/GridPanel/ArrayGrid/Simple/) and works fine at least as far as the column order maintaining is concerned.

Hope this helps; if not, please let us know how you are trying (or need) to attain the component state's memory with a test case.