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

DropDownList as custom editor in grid

3 Answers 691 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Holger
Top achievements
Rank 1
Holger asked on 18 Feb 2013, 10:42 AM
Hi,

I would like to use a DropDownList as custom editor in combination with a colum template inside a Grid. The problem now is that the gid does not accept the selected value of the DropDownList, it always jumps back to thre previous value.

What's going wrong there?

JS Bin sample: http://jsbin.com/afadeh/1/edit

Thanks,
Holger

3 Answers, 1 is accepted

Sort by
0
Accepted
Iliana Dyankova
Telerik team
answered on 20 Feb 2013, 10:20 AM
Hi Holger,

In the provided example I observed that you pass the "value" field for the DropDownList as a value while it should be string. Also in order to match the values after edit you should define the "value" field in the Grid's data as string. For your convenience I updated the jsBin example

Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Holger
Top achievements
Rank 1
answered on 20 Feb 2013, 11:35 AM
Hi Iliana,

Many thanks for your help - now it works as expected.

But I'm still a bit confused. The documentation does not say that the type of field the 'dataValueField' points to has to be a string. Also the example provided there uses a number field.

Just for clarification: Does that means the DropDownList can only bound to string type fields?

Because I want the field in the Grid's data to be a boolean and not string type I added a DataSource that converts the type via model configuration - seems to work fine. The updated JS Bin sample is here.

Thanks,
Holger
0
Iliana Dyankova
Telerik team
answered on 22 Feb 2013, 12:14 PM
Hi Holger,

The suggested solution is due to a scenario where the DropDownList is bound to a boolean (actually passing a boolean value is not a standard scenario). By design Kendo UI DropDownList expects its valueField to be bound to a number field (as in the documentation).

Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Holger
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Holger
Top achievements
Rank 1
Share this question
or