Welcome Guest Search | Active Topics | Sign In | Register

Expand and Collapse SlideMenu menuitem via JavaScript... Options
Bazooka
Posted: Tuesday, February 2, 2010 5:10:24 PM
Rank: Advanced Member
Groups: Member

Joined: 7/3/2009
Posts: 37

Is it possible to collapse a slidemenu menuitem in javascript? I know how to do this on the serverside but what about on the clientside. Do you have any examples.

Server Side Example:

if (e.MenuItem.Expanded== true) { e.MenuItem.Expanded= false;}
else {e.MenuItem.Expanded= true;}


eo_support
Posted: Wednesday, February 3, 2010 9:31:35 AM
Rank: Administration
Groups: Administration

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

I believe it is available through our client side API:

http://doc.essentialobjects.com/library/1/clientapi_howto.aspx

Thanks!
Bazooka
Posted: Wednesday, February 3, 2010 5:08:26 PM
Rank: Advanced Member
Groups: Member

Joined: 7/3/2009
Posts: 37
Thanks for pointing me in the right direction I almost got it going but I can't mimic the server code on the client side. There isn't a expanded method on the clientside. With the jscript code (see below) I try to toggle open/close on the menuitem but it won't work right. It opens and closes but not on th third click on the menuitem. Basically I want it to toggle open and close everytime I select the menuitem. On the serverside it's straight forward see below. Is there a jscript method I can use that works like the expanded method on the server side? Your help will be appreciated very much, thanks.

Server Side Example:

if (e.MenuItem.Expanded== true) { e.MenuItem.Expanded= false;}
else {e.MenuItem.Expanded= true;}


function on_item_click(e, info)
{ //This function allows the slidemenu to close/collapse when the icon or text is selected.

//info is the NavigatorEventInfo
var group= info.getItemGroup(); //Get the ItemGroup

//Get the index location of the selected menu Item.
var iIndexLocation= info.getItem().getIndex();

//collapses the sub menu if it is currently expanded, otherwise it does nothing.
group.getItemByIndex(iIndexLocation).collapseSubMenu();

}
eo_support
Posted: Thursday, February 4, 2010 9:18:41 AM
Rank: Administration
Groups: Administration

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

Please check whether you have the latest version. It has expandSubMenu method:

http://doc.essentialobjects.com/library/1/jsdoc.public.menuitem.expandsubmenu.aspx

Thanks


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.