This is a question that comes up once in a while so I thought I'd write it up as a sort of master-answer.
Say I have several different views in my app that all have the same set of Pulldowns (or TextField) modules at the top. When a user picks a value in one or more of these form elements, I want that value to stick with them even if they just randomly click away to one of the other views using the app navigation. Can this be done?
In other words I'm not talking about maintaining the selection through a drilldown click, but rather if the user uses the app navigation menu to go to a different page in the app, that new page has these same form elements there, I want the same elements from the Pulldown menu to be selected when the next page loads.
And the question is - how to do this.
Here is how you would set this up with the Sideview Utils modules Pulldown and CustomBehavior. The basic idea is to actively rewrite all the relevant links on the page so as to preserve the most recently selected value(s) in all of those links, and then rely on the URLLoader module in all of these views to load the values from the URL and prepopulate the Pulldowns/TextField modules in each target view as the user clicks around.
Part 1) Download and install a recent copy of Sideview Utils from the sideview site ( http://sideviewapps.com/apps/sideview-utils )
Part 2) XML that sets up a working testcase:
<view autoCancelInterval="90" isVisible="False" onunloadCancelJobs="true" template="dashboard.html" isSticky="False"> <label>Testcase for Link-rewriting customBehavior</label> <module name="AccountBar" layoutPanel="appHeader" /> <module name="AppBar" layoutPanel="appHeader" /> <module name="SideviewUtils" layoutPanel="appHeader"></module> <module name="Message" layoutPanel="messaging"> <param name="filter">*</param> <param name="maxSize">2</param> <param name="clearOnJobDispatch">False</param> </module> <module name="HTML" layoutPanel="viewHeader"> <param name="html"><![CDATA[ <h1>Testcase for Link-rewriting customBehavior</h1> ]]></param> </module> <module name="URLLoader" layoutPanel="panel_row1_col1" autoRun="True"> <param name="keepURLUpdated">True</param> <module name="Pulldown" group="static config"> <param name="name">test1</param> <param name="label">test1</param> <param name="staticOptions"> <list> <param name="label">fooLabel</param> <param name="value">fooValue</param> </list> <list> <param name="label">barLabel</param> <param name="value">barValue</param> </list> <list> <param name="label">bazLabel</param> <param name="value">bazValue</param> </list> </param> <module name="CustomBehavior"> <param name="customBehavior">addSelectionToAllLinksOnPage</param> </module> <module name="HTML"> <param name="html"><![CDATA[ <p> selected value is:<br> $test1$ </p> Note that the customBehavior will only rewrite links that are in the app navigation menus. So barring some modification to the JS, the following links will NOT get the special href-rewriting behavior. <br> <a href="testcases_for_link_rewrite_custom_behavior">link1</a><br> <a href="/app/sideview_utils/testcases_for_link_rewrite_custom_behavior">link2</a> ]]></param> </module> </module> </module> </view>
Part 3: The JS that you put in application.js
Note: Don't let this very complicated custom code make you think that Pulldown module is difficult to use. It's actually much much simpler to use than the equivalent core modules and here's a screencast to prove it to you - http://www.youtube.com/watch?v=fkXBgkwZoEQ
thank you Nick,Really helped me.
is it possible to add a table name in side view table modules? or do i have to use html panel for the same?
Assuming you mean adding some visible header text just above the Table? If so then indeed you should just use an HTML module. Generally such text will be above the Pager module, so even if there was a built-in header in the Table, it would be of little use.
Ya, you are right nick,
in simple XML we have an option like