I need a kendo grid with two columns for a single field, but with different editors:
{
field: "VGNCode" // default text box editor
},
{
field: "VGNCode",
editor: codeDropDownEditor
},
When i go into edit mode, both editors show up in both columns.
I expect the text box editor to show up in the first column and the dropdown list in the second column.
Is this a bug?
Is there a work-around?
I’m using Kendo UI v2016.3.1118 with AngularJS.
Thanks in advance!
6 Answers, 1 is accepted
After testing the scenario, the columns have a different editor on my end even if they are bound to the same field:
http://dojo.telerik.com/oliyiT
As I can assume that there is a factor which we are overlooking at this moment, please send a fully runnable example and I will gladly assist.
Regards,
Stefan
Progress Telerik
The two-way binding between the dataItem and the editor is achieved through the "data-bind" attribute and the "name" of the editors and with "inline" edit mode, rendering two editors for the same field will result in elements with identical "name" and "data-bind" attributes. I have to say that there is no built-in workaround that we could suggest for such requirement.
On a side note, could you please elaborate what is the reason behind displaying two different editors for the same field?
Regards,
Konstantin Dikov
Progress Telerik
I sure can. Thanks for asking.
The editor displayed in Column C differs depending on the value selected in Column B. As an example, say Column B is "method of verification" with options of "birthdate" or "department". When "birthdate" is selected, I want Column C to be a date picker. When "department" is selected, I want Column C to be a drop down list. It both cases, they are setting a generic "value" field on my Model. Additionally, when editing a new row, and no "method of verification" has yet been selected, I want no editor shown at all in Column C.
One of many ideas I had for solving this was to create multiple columns, showing and hiding appropriate columns based on the selected value. (That led me to the issue described in this thread.) Instead, I am now destroying and recreating inputs in the single editor when the value in Column B changes.
I see benefits and drawbacks to both solutions, though showing and hiding columns was actually cleaner in my code, had it worked as expected.
If there is another solution I've overlooked, I'd be happy to hear it.
Changing the editors dynamically in a single cell/column would be the recommended approach, because rendering multiple editors for the same field in multiple columns will not be possible. Another option would be to use "Batch/InCell" edit mode and initialize the editor for the C column based on the value of the other field:
Best Regards,
Konstantin Dikov
Progress Telerik