This is a migrated thread and some comments may be shown as answers.

React Grid Editable Conditional Based On Other Column Values

2 Answers 76 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
Iron
Veteran
David asked on 04 Mar 2021, 10:06 AM

Hi,

GridColumnProps has an editable prop which accepts boolean values only. Is it possible to conditionally set the editability of a column based on values in other columns?

Kind regards,

David

2 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 04 Mar 2021, 02:22 PM

Hello, David,

The editable prop can be set to a function to change it dynamically.

For example, you can keep the edited records inside the state, and use them in the function:

https://stackblitz.com/edit/react-97m1zg-gyj2wm?file=app/main.jsx

Another option is to use the cell prop of the column where the developer has full control over what to render. This has the entire row information available, and the developer can decide to render the editor or the value:

https://www.telerik.com/kendo-react-ui/components/grid/editing/editing-custom/ (here we can add extra conditions to the DropDownList cell)

I hope one of the approaches proves helpful.

Regards,
Stefan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
David
Top achievements
Rank 1
Iron
Veteran
answered on 04 Mar 2021, 02:31 PM

Thanks Stefan, I will try these out.

Kind regards,

David

Tags
General Discussions
Asked by
David
Top achievements
Rank 1
Iron
Veteran
Answers by
Stefan
Telerik team
David
Top achievements
Rank 1
Iron
Veteran
Share this question
or