This is a migrated thread and some comments may be shown as answers.
Context menu displays slow
3 Answers 41 Views
This is a migrated thread and some comments may be shown as answers.
Andrew Kitchens
Top achievements
Rank 1
Andrew Kitchens asked on 26 Nov 2010, 08:49 AM
After upgrading from 2010.1.309.35 to 2010.2.929.35 the rad context menu takes 6 seconds to display.
The menu is displayed using menu.showAt(x,y) in javascript. On click the menu is cleared, new items added and then displayed.
Any ideas why it stopped working?

function buildbluemenu(result) {
    contextMenu.get_items().clear();
     
    var setupmenu = new Telerik.Web.UI.RadMenuItem();
    setupmenu.get_groupSettings().set_offsetX(5);
    setupmenu.set_text("Setup");
    setupmenu.set_imageUrl(rootPath + "Images/icons/Setup.gif");
    contextMenu.get_items().add(setupmenu);
 
    var pointeditormenu = new Telerik.Web.UI.RadMenuItem();
    pointeditormenu.get_groupSettings().set_offsetX(5);
    pointeditormenu.set_text("Point Editor");
    setupmenu.get_items().add(pointeditormenu);
     
    var trendeditormenu = new Telerik.Web.UI.RadMenuItem();
    trendeditormenu.get_groupSettings().set_offsetX(5);
    trendeditormenu.set_text("Trend Editor");
    setupmenu.get_items().add(trendeditormenu);
     
    var alarmeditormenu = new Telerik.Web.UI.RadMenuItem();
    alarmeditormenu.get_groupSettings().set_offsetX(5);
    alarmeditormenu.set_text("Alarm Editor");
    setupmenu.get_items().add(alarmeditormenu);
 
    var runtimemenu = new Telerik.Web.UI.RadMenuItem();
    runtimemenu.get_groupSettings().set_offsetX(5);
    runtimemenu.set_text("Runtime Chart");
    runtimemenu.set_imageUrl(rootPath + "Images/icons/Runtime.gif");
    contextMenu.get_items().add(runtimemenu);
     
    var schedulemenu = new Telerik.Web.UI.RadMenuItem();
    schedulemenu.get_groupSettings().set_offsetX(5);
    schedulemenu.set_text("Schedules");
    schedulemenu.set_imageUrl(rootPath + "Images/icons/Schedules.gif");
    contextMenu.get_items().add(schedulemenu);
     
    var trendmenu = new Telerik.Web.UI.RadMenuItem();
    trendmenu.get_groupSettings().set_offsetX(5);
    trendmenu.set_text("Trends");
    trendmenu.get_groupSettings().set_offsetX(5);
    trendmenu.set_imageUrl(rootPath + "Images/icons/Chart.gif");
    contextMenu.get_items().add(trendmenu);
     
    var alarmmenu = new Telerik.Web.UI.RadMenuItem();
    alarmmenu.get_groupSettings().set_offsetX(5);
    alarmmenu.set_text("Alarms");
    alarmmenu.set_imageUrl(rootPath + "Images/icons/Alarms.gif");
    contextMenu.get_items().add(alarmmenu);
     
    var notesmenu = new Telerik.Web.UI.RadMenuItem();
    notesmenu.get_groupSettings().set_offsetX(5);
    notesmenu.set_text("Notes");
    notesmenu.set_imageUrl(rootPath + "Images/icons/Note.gif");
    contextMenu.get_items().add(notesmenu);
     
    var commandmenu = new Telerik.Web.UI.RadMenuItem();
    commandmenu.get_groupSettings().set_offsetX(5);
    commandmenu.set_text("Command");
    commandmenu.set_imageUrl(rootPath + "Images/icons/Command.gif");
    contextMenu.get_items().add(commandmenu);
     
    // Command menu
    if (commandable == true) {
        commandmenu.enable();
    } else {
        commandmenu.disable();
    }
 
    // Schedule menu
    var isSchedule = $(result).find('IsSchedule').text();
     
    if (isSchedule == 1) {
        schedulemenu.enable();
    } else {
        schedulemenu.disable();
    }
    result = $(result);
 
    // Alarmmenu
    var counter = 0;
    alarmmenu.disable();
    $(result).find('Alarm').each(function() {
        counter++;
    });
 
    if (counter > 0) {
        alarmmenu.enable();
    }
 
    // Trendmenu
    counter = 0;
    trendmenu.disable();
    $(result).find('Trend').each(function() {
        counter++;
        var trendid = $(this).find('Id').text();
        var childItem = new Telerik.Web.UI.RadMenuItem();
        childItem.set_text($(this).find('Description').text());
        childItem.set_value("TrendId:" + trendid);
        trendmenu.get_items().insert(i, childItem);
    });
 
    if (counter > 0) { trendmenu.enable(); }
     
    // Done building, display the menu.
    contextMenu.showAt(x, y);
}

3 Answers, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 01 Dec 2010, 05:00 PM
Hello Andrew,

Unfortunately we couldn't reproduce the problem , everything is working fine with your script on our test page.
The context menu is created relatively fast on both Mozilla Firefox and IE.
Would you be so kind to send us a liveUrl to your page in order to investigate the problem on your side.

Greetings,
Dimitar Terziev
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Ragnar
Top achievements
Rank 1
answered on 05 Aug 2011, 04:38 PM
Hello.

I have a similar problem (see: http://www.telerik.com/community/forums/aspnet-ajax/menu/performance-issue-when-dynamically-adding-items-to-a-radcontextmenu-in-the-client.aspx)  Has this problem been resolved? 

Best regards,
Ragnar
0
Peter
Telerik team
answered on 11 Aug 2011, 05:06 AM
Hello Ragnar,

If you need to load a lot of items on the client, I recommend you consider using RadMenu with Web Service.


Kind regards, Peter
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Menu
Asked by
Andrew Kitchens
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Ragnar
Top achievements
Rank 1
Peter
Telerik team
Share this question
or