Change Editor Per Row

1 Answer 94 Views
Editor Grid
Ken
Top achievements
Rank 1
Iron
Ken asked on 11 Aug 2022, 08:24 PM | edited on 11 Aug 2022, 08:25 PM
Hi,

I am working with a grid that uses two columns (Settings & Value). I currently have the Value column editable, but I would like to add a specific editor to each value depending on the type of setting I have. So far it looks like you can only set one type of editor for the entire column. I am curious if there is a workaround I am missing to be able to change the editor type per row.

Thank you
Ken
Top achievements
Rank 1
Iron
commented on 11 Aug 2022, 09:20 PM | edited

So I think I did come up with a work around, but please still comment if there is a simpler way.

I found that if I use a custom-editor I can use v-if/v-else-if to change what the cell is based on information in that row.

In the example I linked below I set a condition on the Discontinued column that if the Units value was less then 20 then when editing the column it would be an input type, if it was over 20 then it would be a dropdown selection.

https://codesandbox.io/s/dropdown-vs-input-fsj8xe

Petar
Telerik team
commented on 12 Aug 2022, 05:46 AM

Hi, Ken.

Thank you for the provided example. The approach that you shared is correct. If we want to have different editors in specific Grid editing scenarios, this can be achieved with a custom template. Inside the custom template, the logic that should be implemented should have a v-if/v-else-if structure.

The implementation that you shared is similar to what we would suggest as a solution. 

1 Answer, 1 is accepted

Sort by
0
Accepted
Ken
Top achievements
Rank 1
Iron
answered on 12 Aug 2022, 12:54 PM | edited on 12 Aug 2022, 12:54 PM
Question Answered Above
Petar
Telerik team
commented on 12 Aug 2022, 01:02 PM

Hi, Ken.

Thank you for the above post. It will help the other users easily navigate the current thread if they land on it. 

Tags
Editor Grid
Asked by
Ken
Top achievements
Rank 1
Iron
Answers by
Ken
Top achievements
Rank 1
Iron
Share this question
or