|
Rank: Member Groups: Member
Joined: 6/29/2007 Posts: 12
|
When I used the Menu Clickhandler to select the Menuitem with vb.net code: e.NavigationItem.Selected = True the menu was selected in the menu.
But when I'm using the Menu Click event (ClientSideOnItemClick) with the eo_Callback JavaScript function the menuitem is not selected anymore. How can I select the menuItem clicked with JavaScript, vb.net or by some configuration for the menu?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi Robert, You can find a sample at here: http://www.essentialobjects.com/Demo/Default.aspx?path=Menu\menu_programming\_i2\js_modify_menuThe sample code calls setDisabled, you would need to change it to setSelected. Thanks
|
|
Rank: Member Groups: Member
Joined: 6/29/2007 Posts: 12
|
Thanks for that sample! I created this code:
Code: JavaScript
var group = info.getItem().getParentGroup();
for (var i = 0; i < group.getItemCount(); i++)
group.getItemByIndex(i).setSelected(false);
info.getItem().setSelected(true);
But i do have some small problems yet with the menu. The sub items are selected even after i select some new main item.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Yes. That is normal because when you select a new item in sub menu A, you won't be clearing out items in sub menu B. The best way for you is to "remember" the last selected item and then unselect that single item:
Code: JavaScript
var g_LastSelectedItem = null;
function menu_item_click_handler(e, info)
{
if (g_LastSelectedItem)
g_LastSelectedItem.setSelected(false);
g_LastSelectedItem = info.getItem();
g_LastSelectedItem.setSelected(true);
}
|
|