Right Click Multiselects Rows

6 posts, 0 answers
  1. dave
    dave avatar
    13 posts
    Member since:
    Sep 2008

    Posted 07 Feb 2012 Link to this post

    I am using the version 2011.3.1305.35 of the RadGrid and experiencing some strange behavior when the grid is right clicked. Occasionally when a user right clicks the gird to bring up a context menu the row that was right clicked will be selected in addition to any rows that were previously selected. The other times it just displays the context menu without selecting the rows. It seems to be intermittent and I cannot consistently reproduce results. I do not want the additional rows to be selected. Is there any way to trap how a row became selected? The domEvent property of the onrowselecting event args does not look like it has what I need.

     
    Here is how i have the grid configured and the code that displays the context menu:

    <telerik:RadGrid ID="tGrid" runat="server" AllowPaging="True" AllowCustomPaging="true" PageSize="500"
                    AllowSorting="True" AutoGenerateColumns="False" CellSpacing="0"
                    OnNeedDataSource="tGrid_NeedDataSource" AllowMultiRowSelection="true"
     OnItemCreated="tGrid_ItemCreated" >
                    <PagerStyle AlwaysVisible="True" Position="Top"/>
                    
                    <MasterTableView Width="100%" DataKeyNames="schedID" ClientDataKeyNames="schedID">
                        <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>                   
                        <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                        <Columns>
                            ...
                        </Columns>
     
                        <EditFormSettings>
                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                            </EditColumn>
                        </EditFormSettings>
                    </MasterTableView>
                    <ClientSettings EnableRowHoverStyle="true">
                        <Selecting AllowRowSelect="True" />
                        <ClientEvents OnGridCreated="GridCreated"
                                      OnRowContextMenu="RowContextMenu" OnRowDblClick="tGrid_RowDblClick" />
                        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                    </ClientSettings>                          
                    <FilterMenu EnableImageSprites="false"></FilterMenu>               
                </telerik:RadGrid>

     

    function RowContextMenu(sender, eventArgs)
    {
        var contextmenu = $find("<%=DisplayContextMenu.ClientID %>");
         
        //get_domEvent returns a reference to the DOM event that caused the clicking
        var domEvent = eventArgs.get_domEvent();
     
        //If we're in an input field or a link, just ignore this request for a context menu
        if (domEvent.target.tagName == "INPUT" || domEvent.target.tagName == "A")
            return;
                       
        contextmenu.show(domEvent);
         
        domEvent.cancelBubble = true;
        domEvent.returnValue = false;
     
        if (domEvent.stopPropagation)
        {
            domEvent.stopPropagation();
            domEvent.preventDefault();
        }
     
        if(sender.get_id() == "<%= tGrid.ClientID %>")
            rightClickedRowId = eventArgs.getDataKeyValue("schedID")                
    }


    Thanks Dave

  2. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 09 Feb 2012 Link to this post

    Hi Dave,

    Are you using the drag-to-select feature of the grid? Does EnableDragToSelect=false make any difference? Do let us know if it is a feasible work-around for you.

    Regards, Tsvetoslav
    the Telerik team

    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

  3. DevCraft Release
  4. dave
    dave avatar
    13 posts
    Member since:
    Sep 2008

    Posted 09 Feb 2012 Link to this post

    Yes, that does seem to help. However, when I use the shift key to select multiple rows the contents on the page gets selected as well. It does not look as nice as it did when the EnableDragToSelect was set to true. Is there any way to prevent the page selection?

    Thanks,
    Dave

  5. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 10 Feb 2012 Link to this post

    Hello Dave,

    Our development team will be looking into a possible fix for the issue and we will be getting back to you with further information. 

    Regards,
    Tsvetoslav
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

  6. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 10 Feb 2012 Link to this post

    Hello Dave,

    Our development team will be looking into a possible fix for the issue and we will be getting back to you with further information. 

    Regards,
    Tsvetoslav
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

  7. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts
    Member since:
    Sep 2012

    Posted 23 Feb 2012 Link to this post

    Hi Dave,

    The issue has just been fixed and the fix will be available in the next latest internal build of the controls that's coming up on Tuesday next week. Thanks for turning our attention to this problem. I have updated your telerik points.


    All the best, Tsvetoslav
    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.

Back to Top
DevCraft Release