|
Rank: Advanced Member Groups: Member
Joined: 6/1/2007 Posts: 31
|
How can I display different ContextMenu's depending on the different types of TreeNodes. With Javascript I can get the node text by node.getText() or the value by node.getValue() but how can I get the ItemID? The ItemID should contain my different Looks so that I can determine what ContextMenu to display.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
|
|
Rank: Advanced Member Groups: Member
Joined: 6/1/2007 Posts: 31
|
Then why do I get undefined in the alert box with this?
<script type="text/javascript"> function ShowContextMenu(e, treeView, node) { //Get the context menu object var menu = eo_GetObject("<%=eo_menu_Content.ClientID%>");
alert(node.getItemId());
eo_ShowContextMenu(e, "<%=eo_menu_Content.ClientID%>"); return true; } function MenuItemClickHandler(e, info) { window.alert("Menu item '" + info.getItem().getValue() + "' clicked."); } </script>
|
|
Rank: Advanced Member Groups: Member
Joined: 6/1/2007 Posts: 31
|
Sorrr to bug you again but do you have any solution for this yet?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We are not aware of any problem with getItemId function. It should return whatever ItemID value you set on the server side. If the node has ItemID set, getItemId will return the set value; otherwise it has nothing to return and you get undefined.
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 6/1/2007 Posts: 31
|
Thank You for your help I did not know I had to bind something to that Property. After Binding it works fine
|
|
Rank: Advanced Member Groups: Member
Joined: 6/1/2007 Posts: 31
|
Ok yes what you said worked however now that I'm also Binding the ItemID so that I can read it in the JavaScript and display my correct ContextMenu I can no longer get the OnItemClick or OnItemMove to work in the TreeView. If I comment out the DataBinding of the ItemID then the OnItemMove works and the OnItemClick works.
Is there any way that with the
function ShowContextMenu(e, treeView, node)
to read the LookID or other properties that will not break the one action for another?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Please see here for a list of available methods on the client side: http://doc.essentialobjects.com/library/1/jsdoc.public.navigationitem.aspxhttp://doc.essentialobjects.com/library/1/jsdoc.public.menuitem.aspxMost people use Value property because it is not used by the control in any way (unlike ItemID which is being used to create node path). I don't believe you can get LookID from client side. Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 6/1/2007 Posts: 31
|
I found that the property axp in the node has what I need. Do you change these properties with your builds or am I safe to use this.
<script type="text/javascript"> function ShowContextMenu(e, treeView, node) { //Get the context menu object var ItemId = node['axp']; switch (ItemId) { case "_SubmittedList": eo_ShowContextMenu(e, "<%=eo_menu_SubmittedList.ClientID%>"); break case "_LockedList": eo_ShowContextMenu(e, "<%=eo_menu_LockedList.ClientID%>"); break case "_DefaultList": eo_ShowContextMenu(e, "<%=eo_menu_DefaultList.ClientID%>"); break case "_Default": eo_ShowContextMenu(e, "<%=eo_menu_Default.ClientID%>"); break case "_Root": eo_ShowContextMenu(e, "<%=eo_menu_Root.ClientID%>"); break default: alert('Sorry no menu for this group'); } return true; } </script>
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You don't want to rely on that because the name "axp" can change between every build. We will see if we can add it as a documented function but please understand that we have to be very careful about adding things because we can't just add everything everyone wanted.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 6/1/2007 Posts: 31
|
Yes I understand that you can not add something every time some requests. Please let me know if you do add this in the next build though
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
will do.
|
|