This is a migrated thread and some comments may be shown as answers.

RadPanel and Hover RadContextMenu

4 Answers 96 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Kori
Top achievements
Rank 2
Kori asked on 12 Feb 2010, 05:46 PM
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

4 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 18 Feb 2010, 08:05 AM
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.
0
Kori
Top achievements
Rank 2
answered on 18 Feb 2010, 04:44 PM
Oops, sorry .. it's actually just a typo.

This line:
$('.anItem').hoverIntent(config); 
should be:
$('.anItem').hoverIntent(hoverIntentConfig); 
0
Yana
Telerik team
answered on 23 Feb 2010, 12:49 PM
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.
0
Kori
Top achievements
Rank 2
answered on 23 Feb 2010, 01:51 PM
Alright, I've submitted the support ticket.

Thanks Yana.

- Kori
Tags
PanelBar
Asked by
Kori
Top achievements
Rank 2
Answers by
Yana
Telerik team
Kori
Top achievements
Rank 2
Share this question
or