Display issue with rounded corners and clearing menu items

5 posts, 0 answers
  1. James
    James avatar
    35 posts
    Member since:
    Apr 2010

    Posted 24 Jun 2010 Link to this post

    I also posted this question on this thread: http://www.telerik.com/community/forums/aspnet-ajax/menu/prevent-expandmode-webservice-nodes-from-being-cached.aspx

    I have a menu that is loaded on demand but I don't want to have the client cache the values - I want a call made each time to load the values when the menu is expanded.  I followed the example from the above thread and it works great when not using rounded corners.  However, when I turn on rounded corners, the second time the menu expands, the corners/borders are missing. 

    It appears this happens any time I clear the collection of menu items.  Here is my js:

    function mainMenuItemClosed(sender, eventArgs)   
                {  
                    var item = eventArgs.get_item();  
                    if (item)  
                    {  
                        sender.trackChanges();  
                        item.get_items().clear();  
                        item.set_expandMode(Telerik.Web.UI.MenuItemExpandMode.WebService);  
                        item._itemsLoaded = false;  
                        sender.commitChanges();  
                    }  
                } 
  2. Kamen Bundev
    Admin
    Kamen Bundev avatar
    1532 posts

    Posted 29 Jun 2010 Link to this post

    Hello James,

    This issue was fixed and the fix will be available in the next release. I've updated your Telerik points for the report.

    Kind regards,
    Kamen Bundev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. piotre6
    piotre6 avatar
    18 posts
    Member since:
    Apr 2011

    Posted 19 Sep 2012 Link to this post

    Hello Kamen,
    I wonder if problem has been fixed. I have problem with my menu in similar scenario.
    I use same JavaScript code in my OnClientItemClosed but menu doesnt work if I click menu item

    Context menu code:
    <telerik:RadContextMenu ID="ContractorContext" runat="server"
        OnClientItemClicked="contractor_Grid_ContextMenu_OnClicked"
        OnClientItemPopulating="contractor_Grid_ContextMenu_OnPopulating"
        OnClientItemClosed="contractor_Grid_ContextMenu_OnItemClosed"
        OnClientItemOpening="onOpening"
        EnableRoundedCorners="true" EnableShadows="true" >
        <WebServiceSettings Path="~/WebServices/ContextMenus.asmx" Method="GetContractorsMenu" />
        <LoadingStatusTemplate >
            <asp:Image runat="server" ID="LoadingImage" ImageUrl="~/Images/loading1.gif" ToolTip="Loading..." Width="16px" Height="16px" style="margin-top:8px" />
        </LoadingStatusTemplate>
        <Items>
            <telerik:RadMenuItem runat="server" Value="labels"
                ExpandMode="WebService" Text="Dodaj do etykiet"></telerik:RadMenuItem>
            <telerik:RadMenuItem runat="server" Value="postingbook"
                ExpandMode="WebService" Text="Dodaj do ksiązki adresowej"></telerik:RadMenuItem>
        </Items>
    </telerik:RadContextMenu>

    I right click on grid row to get context menu, menu with two elements appears (with red 0),
    then I select first item and next items get loaded (red 1), now I select first item that has childs and menu appears(red 2)
    if I click anywere outside menu or item from 0 or 1 menu everything is fine, there are no problems with doing that again.
    everytime I select item that should have childrens webservice is called to get items.
    If I click somthing form 2 (eg. middle item Piotrek) action is performed, menu disappears but since now menu doesnt work anymore.

    I try to right click on grid row, menu with two positions appears again (red 0) but marking any of items causes error:
    Microsoft JScript runtime error: Unable to get value of the property '_getChildren': object is null or undefined

    I went through functions call stack and there is one things that in my opinion could cause problem:
    in function _findItemByHierarchicalIndex parameter d passed to the function was "0:-1:-1"
    that means that in if statment
    if(f._getChildren().get_count()<=c)
    
    even if f._getChildren().get_count() is 0 it is compared to -1 
    With first time menu gets shown I dont get to that function
  5. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 24 Sep 2012 Link to this post

    Hi Piotr,

    The issue that you describe is indeed very strange one. However, I would suggest that you open a support ticket where you can attach a simplified runnable project that we can test locally and determine the actual cause for the issue that you get. Can you also clarify the version of the controls that you are using? 

    Kind regards,
    Kate
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Tom
    Tom avatar
    4 posts
    Member since:
    Aug 2011

    Posted 22 Jan 2013 Link to this post

    This looks like a bug on a menu that is recreated on the client each time it is shown.

    When you select a child menu item it's 'index' gets cached into _selectedItemIndex (e.g. the 1st child of the 1st root item  as "-1,0" ). _selectedItemIndex remains on the next click, even after callng menu.get_items().clear() or item.set_selected(false) and menu.get_items().removeAt(i) on each item.  This value gets passed to _findItemByHierarchicalIndex(e) as e. If you follow the logic of the _findItemByHierarchicalIndex(),
     c = -1 where d = 0 and b = ["-1", "0"];
    and
    a = null after a = f._getChildren().getItem(-1);
    and
    f = a, so on the next iteration it's dotting into a null f on f._getChildren()

    Why does this occur? How to correct it?
    _findItemByHierarchicalIndex:function(e)
    {
      var a=null;
      var f=this;
      var b=e.split(":");
      for(var d=0;d<b.length;d++)
      {
        var c=parseInt(b[d]);
        if(f._getChildren().get_count()<=c)
        {
          return null;
        }
        a=f._getChildren().getItem(c);
        f=a;
      }
      return a;
    }
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017