RadContextMenu's showAt() breaks

2 posts, 0 answers
  1. Prachi
    Prachi avatar
    6 posts
    Member since:
    Apr 2012

    Posted 22 Aug 2014 Link to this post


    I am using Teleriks' 2014.2.618 version. Earlier, I was using 2012 ones. 

    I have ContextMenu on RadGrid which is suppose to open a menu. It worked perfectly fine on 2012 version. However, on 2014, the ContextMenu doesn't open up. While debugging our javascript its breaks at contextmenu.showAt(100,100). 

    We verified the passing parameter as integer. We pass the RadGrid's Id as sClientId.

    It throws error as : Unable to get property 'showAt' of undefined or null reference 

    var x = 0;
    var y = 0;

    function showMenu()
            x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
            y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;

            var contextMenu = $find(sClientId);
            contextMenu.showAt(x, y);

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Aug 2014 in reply to Prachi Link to this post

    Hi Prachi,

    Unfortunately I couldn't replicate the issue at my end. Please try the below sample code snippet which works fine at my end.

    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" GridLines="None"
        AllowSorting="True" AllowPaging="True" PageSize="50" Width="900px">
            <ClientEvents OnRowContextMenu="RowContextMenu" />
            <Selecting AllowRowSelect="true" />
            <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="2">
        <HeaderStyle Width="225px"></HeaderStyle>
        <PagerStyle PageSizeControlType="RadDropDownList" Mode="NextPrevAndNumeric"></PagerStyle>
    <telerik:RadContextMenu ID="RadMenu1" runat="server" EnableRoundedCorners="true"
            <telerik:RadMenuItem Text="Quick view">
            <telerik:RadMenuItem Text="Add" Value="add">
            <telerik:RadMenuItem Text="Edit" Value="edit">
            <telerik:RadMenuItem Text="Delete" Value="delete">

    function RowContextMenu(sender, eventArgs) {
        var x = 0, y = 0;
        var menu = $find("<%=RadMenu1.ClientID %>");
        var evt = eventArgs.get_domEvent();
        x = evt.rawEvent.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
        y = evt.rawEvent.clientY + document.body.scrollTop + document.documentElement.scrollTop;
        menu.showAt(x, y);

Back to Top