Ticket T863821
Visible to All Users

DataGrid - Right click on row context menu

created 5 years ago

Hi,
we are looking for a way to implment a right click menu for a single or multiple selected rows in a grid. We would like to be able to click anywhere on a selected row to get the context menu, but we seem to be having trouble making this work and cannot seem to find any related questions or examples.

We have found an example using a specific point on the row to right click, but that is not what we are after. Do you have any examples or is this possible?

thank you

Answers approved by DevExpress Support

created 5 years ago

Hello,

We do not have any examples about right clicking DataGrid rows. DataGrid provides the onContextMenuPreparing which provides the row properties when you right click on a row. You can then use the items property for whatever purpose you intent to do.

Would you please clarify your requirements so we can provide you with a precise solution?

We look forward to your response.

    Comments (2)

      I hate to show the cometition, but this was the first one that came up on searching. This is exactly what we are after

      https://demos.telerik.com/aspnet-ajax/grid/examples/columns-rows/columns/context-menu/defaultcs.aspx

      The ways we would use it

      • right click on a single row and get the active rows values
      • right click when multiple rows are selected and get all selected rows.
      DevExpress Support Team 5 years ago

        Hello,

        Thank you for the update.

        You can use DataGrid's getSelectedRowKeys and getSelectedRowsData methods to obtain information from the selected rows. You can use onContextMenuPreparing's items property to perform the actions with the obtained information.

        I have prepared a small demo illustrating the approach.

        Let us know if you have further questions.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.