Rank: Member Groups: Member
Joined: 1/9/2009 Posts: 10
|
Hi
I'm just evaluating the EO package for a project I'm coding. Its all looking very good and I think we will be using it so I'll be purchasing a License shortly.
One thing thats cropped up in our recent dev is to do with the slide menu.
We are using the slide menu and creating menu items on the fly from a dataset. We are then enabling and checking as necessary against the data. Its a filter that is checked/unchecked which then updates a tree for the user to use for content management.
We needed to use a style that enabled the scrolling feature as we have limited space.
We found on postback(and yes we are using eo callback panel) that the area containing the slide menu flashed away as it rebuilt itself. This meant that we lost x scroll coordinates for a checked item and visually jarred the flow of the page. So we used the client side script to capture the check logic and update the database as necessary, to track the menu items data changes and update a second panel that had results tree in it based on the slide menus checked items.
using
function ToggleCheckStatus(e, eventInfo) { if(eventInfo.getItem().getItemId() != "" && eventInfo.getItem().getItemId() != null && eventInfo.getItem().getItemId() !="undefined") { eventInfo.getItem().setChecked(!eventInfo.getItem().getChecked()); //parse a value to a hidden textbox - put a handler on the TB and use it in the __doPostBack event document.getElementById('FilterItemIDHF').value = eventInfo.getItem().getItemId(); document.getElementById('FilterItemValueHF').value = eventInfo.getItem().getValue(); document.getElementById('FilterItemCheckedStatusHF').value = eventInfo.getItem().getChecked(); __doPostBack('HiddenArgsPanel', '');//updates tree panel //tree panel from here - and whilst its being done record the check/unchecked item in the filter data } }
for keeping the items checked/unchecked in the page but updating the selections in the database in the background
We now would like to change the disabled state of some of the menu items based on the checked decisions. But as per the reason above we can't do this through postback as the panel dissapears momentarily.
Is there a way we can disable a menu item via javascript, possibly by using menu item ID data?
As per the Javascript above I think I understand the process of checking/unchecking a single menu item via the code examples supplied but am unsure how to access a single items staus from outside of the ClientSideOnItemClick route.
Thanks for any help you can provide
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You can check/uncheck or enable/disable any item with JavaScript. The key is to get the correct menu item. In order to get the menu item, you would need to get the menu first. This can be done by:
Code: JavaScript
var menu = eo_GetObject("Your_Menu_ID");
Once you have the menu, you can call any methods on the menu object: http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.Navigator.htmlFor example, you can call findItem to locate the specific item:
Code: JavaScript
var menuItem = menu.findItem("products/door");
Or you can call getTopGroup to get the top menu item group and then call methods on the MenuGroup object:
Code: JavaScript
var menuItem = menu.getTopGroup().getItemByIndex(0);
Once you have the menu item, you can call any method on the menu item object: http://www.essentialobjects.com/ViewDoc.aspx?t=JSDoc.Public.NavigationItem.htmlHope this helps. Thanks!
|
Rank: Member Groups: Member
Joined: 1/9/2009 Posts: 10
|
Thats great. Thanks very much.
|