Hello,
First, thank you for all efforts made for this great project!
I’m doing tests for using SmartGWT in portlet environment with JBossPortal 2.7; so, I’m looking at options, as mentionned in the latest release notes, “to save and restore the display and selection state of various components to/from the server”.
Is there any demo or sample showing this?
Thank you in advance.
Bertrand
http://www.odelia-technologies.com/
You can simply call getMembers() on the final state, iterate over them and store the ID’s. You can also find out the number of columns. When you need to restore the layout, create the sample number of portal columns and add members in the order of the previously stored ID’s.
Hello,
In fact my question is not about Portlet in SmartGWT, but about the API I can use to save/store display/selection at level component. So, for example for the ListGrid I see that I can use getViewState/setViewState methods.
Thank you!
Bertrand.
Yes, you can use any getState() method on a component and it will return the corresponding state of the component as a String which you can save to your server. To restore the state, simply call setState(..) passing the previously saved state.
We’ll add samples for this to illustrate how it works, but its usage is trivial as mentioned above. You can take any showcase sample of a Grid or Tree, add two IButton’s - one that gets the state and the other that sets the state. Alter the appearance after getting the state, and then invoke the set*State.