Skip to content

This example demonstrates how to show/hide or enable/disable Edit Form items based on another item's value

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/devextreme-datagrid-hide-show-edit-form-items-dynamically

Repository files navigation

DataGrid for DevExtreme - How to show/hide or enable/disable Edit Form items based on another item's value

This example demonstrates how to implement the following scenarios in DataGrid:

  • Hide the Home Address form item if the AddressRequired value is false.
  • Disable the LastName item editor if the FirstName form item value is empty.

form-items

Implementation Details

  • Define the setCellValue callback function for the "AddressRequired" and "FirstName" columns to re-render items after an editor value is changed.

  • Handle the customizeItem form event.

  • In the event handler, call the getRowIndexByKey and cellValue methods to obtain current editor values. Assign the value obtained from the cellValue method to the item's visible property.

  • In the onEditorPreparing function, change the disabled option of the required form item editor.

Files to Review

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)