Announcement Announcement Module
Collapse
No announcement yet.
Clicking a menu resets div settings Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Clicking a menu resets div settings

    Hi,

    Since I have a lot of menu items (not in this demo project) in my menus I figured I would make a sort of accordian feature of them.

    and it works like a charm, like this :


    Code:
        <menu:menu id="_menu" z="nZaf43BjUg1iM0v70HJVEsXDopc=">
            <menu:category id="c_yourcompany" z="vhrpJyMIrmzPTdhnm4zgeo0AHnQ=">
    	    <div id="div1">
                <menu:item id="i_yourcompany_new" messageCode="global_menu_new" url="/yourcompanys?form" z="9SxT+7bOkPHQfDBOIPg28iO9hiA="/>
                <menu:item id="i_yourcompany_list" messageCode="global_menu_list" url="/yourcompanys?page=1&amp;size=${empty param.size ? 10 : param.size}" z="DxHm9IqXt4yoQlim2bq4MnumrTo="/>
    		</div>
            </menu:category>
            <menu:category id="c_neworimprovedproduct" z="seoNAijNUCLaR5k2HiFJOOvzRzY=">
        	<div id="div2">
                <menu:item id="i_neworimprovedproduct_new" messageCode="global_menu_new" url="/neworimprovedproducts?form" z="d38DiSf0EACiQlc6PrAU2Ad2jSI="/>
                <menu:item id="i_neworimprovedproduct_list" messageCode="global_menu_list" url="/neworimprovedproducts?page=1&amp;size=${empty param.size ? 10 : param.size}" z="kWzOaZdxO4WW5lG1RgulI5t8cH8="/>
    		</div>
            </menu:category>
        </menu:menu>
    		<script type="text/javascript"><![CDATA[
        		<script type="text/javascript"><![CDATA[
    			dojo.addOnLoad(
    				function(){
    					var node1 = dojo.byId('div1');
    					var node2 = dojo.byId('div2');
    					dojo.connect(dojo.byId('c_part1'), 'onclick', function(){
    						node1.style.display = 'block';
    						node2.style.display = 'none';
    					});
    					dojo.connect(dojo.byId('c_part2'), 'onclick', function(){
    						node1.style.display = 'none';
    						node2.style.display = 'block';
    						node3.style.display = 'none';
    					});
    					 });]]>
    		</script>

    But my problem is , every time you click something from the menu the hidden/displayed menu categories reset to the settings they were at at the start of the application which is a bummer.
    This is possibly due to the fact that the page get posted ?
    anyways, I would really like suggestions on how to fix this ? that is how to keep the divs in the same state as before clicking an item from the menu.
    do I need to store their state in session ?
    or what is the best solution ?

    Regards,
    Emil
Working...
X