Skip to content

The example demonstrates how to handle different value types for the same DataGrid column

License

Notifications You must be signed in to change notification settings

markallenramirez/devextreme-datagrid-dynamic-type-column

 
 

Repository files navigation

DataGrid for DevExtreme - How to handle different value types with editCellTemplate for the same column

This example describes a typical usage scenario where users want to have a dynamic column. For instance a column must handle strings/numbers/dates etc.

DataGrid's column data type is specified in the dataType property. If this property is not set it is auto-predicted based on the first row. So, this causes an issue for most customers where their input data changes to a different data type (e.g., input is a string, but it gets cast to a date/number).

 DataGrid for DevExtreme - How to handle different value types with editCellTemplate for the same column

Files to Review

Implementation Details

Set your dynamic column's dataType property to "object". Then, store the data type in a data field, specify editCellTemplate and check the data.Type field's value to render the related editor. Finally, use the setCellValue callback of the Type column to update your dynamic column and rerender editCellTemplate.

Documentation

About

The example demonstrates how to handle different value types for the same DataGrid column

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 50.3%
  • JavaScript 17.9%
  • HTML 16.7%
  • Vue 15.1%