DropDownList as custom editor in grid

4 posts, 1 answers
  1. Holger
    Holger avatar
    77 posts
    Member since:
    Nov 2012

    Posted 18 Feb 2013 Link to this post

    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
  2. Answer
    Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2592 posts

    Posted 20 Feb 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Holger
    Holger avatar
    77 posts
    Member since:
    Nov 2012

    Posted 20 Feb 2013 Link to this post

    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
  5. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2592 posts

    Posted 22 Feb 2013 Link to this post

    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!
Back to Top
Kendo UI is VS 2017 Ready