Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5368
WebDataMenu CSOM addItem
posted

While looking through the 10.3 documentation for the WebDataMenu, I noticed a new function called addItem, which is listed here:

http://help.infragistics.com/NetAdvantage/ASPNET/Current/CLR4.0/?page=WebDataMenu~Infragistics.Web.UI.WebDataMenu~addItem.html

This feature wasn't documented in any of the release notes, and I can't find any sample code, so I am trying to figure out how to use it using the debugger.

Here is what I have observed so far:

  • I am having trouble gaining a reference to the item after it is added, so that I can adjust the navigation URL, etc.
    • If I define a variable and set to equal the result of the addItem operation, the variable is still "undefined" after the item is added.  This seems to contradict the usage displayed in the documentation
    • Even though the item may be displayed on the screen, the Items collection of the parent doesn't seem to contain the new item.
  • The menu height is not adjusted after the item is added, so the item may be obscured by the menu boundary.
  • If I add the item inside of a webdatagrid client event, as shown here, the WebDataMenu actually initiates an AJAX call to the page which fails.  I have no idea what it is trying to do, or why communication with the server would be necessary

Can someone at Infragistics please provide some sliver of sample code that I can use to accomplish the following on the client:

  • In the ItemHovered event, if the item has no child nodes,
    • add a few sample child items,
    • set the navigation URL on each item 
    • and expand.

Pretty please with cherries and a Star Wars action figure on top?

Also, the presence of the AJAX call indicates that maybe there is a way to do AJAX load-on-demand of submenu items.  That is actually preferable to what I was going to do using a WebService.  If you have any documentation on that, I'd be in your debt as well!

Parents
  • 3726
    Verified Answer
    posted

    Hi Rob,

    this API function was present in WebDataMenu since 10.1 version, but it was officially unsupported API. After adding scrolling to web data menu in 10.3 I've noticed this public function and we have decided to fix it. It works properly in the SR release that came out after the new year (2011).

    Actually there are two functions:

    addItem(text, parent) - adds a menu item with the specified text to the parent, it parent is not specified it add to the root and the item is always added last in the collections. The actual add is made by and AJAX call to the server. I do not find this API very useful, but we have to fix it since it is publicly released and we cannot remove functions, because people may use them.

    removeItem(item) - removes the specified item from the menu, again by doing an AJAX call to the server.

    Both functions re-render only the sub items part that is affected by the change unless a root level item is added. Then whole menu contents are refreshed.

    Hope this helps.

    Thanks,

    Lubomir

    PS: And my advise for customers is to always use the latest SR, because we are constantly adding fixes to the Aikido controls that matter.

     

Reply Children