Ticket T954095
Visible to All Users

DataGrid - How to display a read-only popup form

created 4 years ago

Hello!

I need to show an "edit" pop-up form for a read-only data grid. The very simple scenario:

  • all fields are read-only
  • only one button "Close" ("Cancel" would do as well)

The ideal solution would be for the grid to respect editing.AllowAdding(false).AllowDeleting(false).AllowUpdating(false) options and switch to such mode. Could you consider this for a future release?
In any case the present behavior is very strange, if not just a bug, since it shows fully functional pop-up edit form with the "Save" button.

For now I have checked a number of support tickets, but they are either outdated or describe solutions for other (not asp.net core) technologies. Is there a workaround, except fully external pop-up form? The help will be appreciated, since I have too many grids to handle.

Answers approved by DevExpress Support

created 4 years ago

Hi,

Currently, DataGrid does not have a popup read-only mode. We will consider this scenario in future releases. In the meantime, as a possible solution, you can make use of the built-in editing popup form which you can make read-only. For this task, you can do the following:

  • Add a custom button that opens the popup when clicked.
  • Use the editRow method to manually switch a row to the editing state which opens the popup.
  • Set each column's allowEditing option to false. If you have several columns and don't want to add the option manually, you can loop through each column and add the option via the customizeColumns event handler.
  • Modify the toolbarItems of the DataGrid's popup. Here, you can create a custom Close button.
  • Use cancelEditData to discard changes and to manually close the popup.

Please try it and let us know the result.

Regards,
Mark

    Comments (1)
    BV BV
    Boris Verkhovykh 4 years ago

      Thank you, Mark!
      This worked as expected.
      Regards,
      Boris

      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.