Welcome Guest Search | Active Topics | Sign In | Register

[SlideMenu] How to safe Expanded Menu Group Options
WoocasH
Posted: Thursday, February 14, 2008 1:13:05 AM
Rank: Newbie
Groups: Member

Joined: 2/14/2008
Posts: 2
Hi,
I'm using eo.slidemenu with custom menu provider for sidemap (with my own authorization etc.)

When I expand menu group and click any link, after new page load the menu group I've just expanded is now collapsed. I tried to use SeveStateCrossPages but it doesn't work with my menu (custom provider for SiteMapDataSource)

The only thing I don't know how to do is to save currently expanded menu group.
there is an event ClientSideOnGroupExpand but I couldn't find in your support how to use it.
I have my own javasript function:

function on_expand(e, eventInfo)
{
// HOW TO SAVE EXPANDED MENU GROUP INDEX (or sth. like that) TO COOKIE
}

And now :) when user is clicking on the menu group to expand it I have to safe the index of this menu group (client side) and then when a new site is loading I have to get last expanded menu group from cookie and (server side) expand proper group.

How should look the javascript function that saving this expanded menu group index to cookie. ?
eo_support
Posted: Thursday, February 14, 2008 6:04:05 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,083
Hi,

SaveStateCrossPages should work if the ID of the menu is the same on both pages, and it works best if you have the slide menu in a master page. You can also take a look of the following properties:

http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.BaseNavigator.AutoSelectSource.html
http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.BaseNavigator.AutoSelectTarget.html

Set AutoSelectSource to "NavigateUrl" will automatically select the item whose NavigateUrl matches the current page Url. In that case you don't need SaveStateCrossPages.

Back to your original question. Your question is actually two questions:

1. How to get the expanded menu group index?
2. How to save that index to a cookie?

To answer the first question, you would do something like this:

var index = e.getItem().getIndex();

You can find the related reference documentation at here:
http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.NavigatorEventInfo.html
http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.NavigationItem.html

There are also other methods you can use, such as getId, getPath, etc.

For the second question, you can find more information at here:

http://www.w3schools.com/js/js_cookies.asp

Once you've gotten value, saved it, you may still need to read it and set the expanded state back. To set the expanded state, set a top level menu item to selected, for example:

SlideMenu1.getTopGroup().getItemByIndex(your_saved_index).setSelected(true);

Let us know if you have any other questions.

Thanks
WoocasH
Posted: Thursday, February 14, 2008 11:33:45 PM
Rank: Newbie
Groups: Member

Joined: 2/14/2008
Posts: 2
Thanks a lot :) You tell me even more than I needed and expected :)
The problem was in AutoSelectSource - setting it to "NavigateUrl" solved my problem.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.