Over the years I have seen many developers and SDN memebers struggle in pursuit of some solution for a tiny obstacle they had with their project. It then occured to me: we should write very short tip blogs, no more than 10 or 15 lines, that present the problem and offer the immediate solution in a few lines of code. I therefore call my blog “The Weekly Tip” in the hope that others will join me and offer their compact solutions.
In today’s blog I would like to tell you about one of the more complicated projects I took part in, where each member of the development group was responsible for developing one or more DC’s. When the project reached its final stages and after a very large table, which was filled with links to other iviews, was ready, I was asked to provide this table with some filtering and sorting capabilities. A day or so later I asked our QA team to check my work. All well and done, I was told, but after you have filtered your table and navigated to another iview and then return to your original table, all filtering parameters are gone and the table resumes its original size.
So the question is: how do you keep, whatever is needed, over cross iview navigation?
The answer is quite simple: you store everything in a session. The code looks very simple:
WDScopeUtil.set(WDScopeType.CLIENTSESSION_SCOPE, “Name”, “Value”);
And when returning to your original application you wish to retrieve the information you saved, you can use the following code:
String value = WDScopeUtil.get(WDScopeType.CLIENTSESSION_SCOPE, “Name”);
That’s it. By applying this very simple technique, I managed to restore my table to its filtered/sorted state every time the application was called from another iview.
I hope you will all benefit from this presentation.