RadPanel and Hover RadContextMenu

5 posts, 0 answers
  1. kfrancis
    kfrancis avatar
    69 posts
    Member since:
    Dec 2008

    Posted 12 Feb 2010 Link to this post

    Hi,

    I'm getting close - but I'm having an issue with the positioning being consistant. Also, I'd like to be able to click as well as hover - (since I'm using jquery.hoverIntent.js)

    <telerik:RadPanelBar runat="server" ID="itemToolbar" Width="231px" Height="500px" ExpandMode="SingleExpandedItem"  AllowCollapseAllItems="true"
        <DataBindings> 
            <telerik:RadPanelItemBinding CssClass="anItem" Depth="1" /> 
        </DataBindings> 
    </telerik:RadPanelBar> 
    <telerik:RadContextMenu ID="itemMenu" runat="server" OnClientItemClicked="subItemClicked" /> 
     
    $(document).ready(function() { 
        var isShown = false
        var hoverIntentConfig = { 
            sensitivity: 1,     
            interval: 200, // number = milliseconds for onMouseOver polling interval     
            over: function(e) { 
                var itemName = $(this).text(); 
                var panelBar = $find("<%= itemToolbar.ClientID %>"); 
                var theItem = panelBar.findItemByText(itemName); 
                if (theItem != null) { 
                    showItemMenu(theItem.get_element(), itemName); 
                } 
            }, // function = onMouseOver callback (REQUIRED)     
            timeout: 500, // number = milliseconds delay before onMouseOut     
            out: function(e) { 
             
            } // function = onMouseOut callback (REQUIRED) 
        }; 
        // Setup the hoverIntent for every item in the panelBar 
        $('.anItem').hoverIntent(config); 
    }); 
     
    var oldItem = null
    var isCalled = false
    function showItemMenu(targetControl, itemName) { 
        var theMenu = $find("<%= itemMenu.ClientID %>"); 
        theMenu.removeTargetElement(targetControl); 
     
        isCalled = true
        $.ajax({ 
            type: 'POST'
            url: "SamplePage.aspx/GetItemList"
            data: "{'itemName':'" + itemName+ "'}"
            contentType: "application/json; charset=utf-8"
            dataType: "json"
            success: function(result) { 
                if (isCalled == true) { 
                    var menu = $find("<%= itemMenu.ClientID %>"); 
                    menu.trackChanges(); 
                     
                    // Empty the context menu out 
                    menu.get_items().clear(); 
                    var resultItems = result.d.split(","); 
     
                    for (var i = 0; i < resultItems.length; i += 1) { 
                        var subItem = new Telerik.Web.UI.RadMenuItem(); 
                        subItem .set_text(resultItems[i]); 
                        menu.get_items().add(subItem); 
                    } 
                     
                    menu.commitChanges(); 
     
                    oldItem = targetControl; 
                    menu.addTargetElement(targetControl); 
     
                    var offset = $(targetControl).offset(); 
                    menu.showAt(offset.left + 50, offset.top); 
                    isCalled = false
               } 
           }, 
           error: function(result) { 
               if (isCalled == true) { 
                   alert(result.status + " " + result.statusText); 
                   isCalled = false
               } 
           } 
       }); 

    Sometimes it'll work great, but then other times - the position of the menu is all off. I'm not sure why .. 

    Anyone have any advice?
    Thanks,
    Kori
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 18 Feb 2010 Link to this post

    Hi Kori,

    I couldn't test this code, because there is a reference to "config" method, wihich is missing. Could you please send it?

    Kind regards,
    Yana
    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. kfrancis
    kfrancis avatar
    69 posts
    Member since:
    Dec 2008

    Posted 18 Feb 2010 Link to this post

    Oops, sorry .. it's actually just a typo.

    This line:
    $('.anItem').hoverIntent(config); 
    should be:
    $('.anItem').hoverIntent(hoverIntentConfig); 
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 23 Feb 2010 Link to this post

    Hello Kori,

    Could you please open a support ticket and send us a runnable page demonstrating the issue there as I'm not able to reproduce it? Thanks a lot

    Regards,
    Yana
    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.
  6. kfrancis
    kfrancis avatar
    69 posts
    Member since:
    Dec 2008

    Posted 23 Feb 2010 Link to this post

    Alright, I've submitted the support ticket.

    Thanks Yana.

    - Kori
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017