data-value not working when zero

4 posts, 0 answers
  1. Tom B
    Tom B avatar
    2 posts
    Member since:
    Sep 2007

    Posted 12 Mar 2015 Link to this post

    The drop down list is not setting it's value when the value is zero (data-value="0") and I'm not sure why.  The seems to treat the values as numeric instead of a string.  Please see the example:

    http://dojo.telerik.com/UroFA

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 16 Mar 2015 Link to this post

    Hello Randy S,

    Indeed, the parseOption functionality recognizes the "0" as a number and then sets it to the widget. The MultiSelect widget on the other hand cannot select 0 (as a number) as it expects string as a value option.

    I would suggest you use the value binding in order to set the value you want.

    Let me know if I can be of a further assistance.

    Regards,
    Georgi Krustev
    Telerik
     
    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. CDC
    CDC avatar
    3 posts
    Member since:
    Mar 2015

    Posted 16 Mar 2015 in reply to Georgi Krustev Link to this post

    We are binding data on the server (rendering declarative html) so using mvvm isn't really an option for us in this case.   

    The DropDownList will bind with data-value and value IF you use an INPUT tag.  We were using a SELECT tag to back the control.  Why wouldn't it work the same for a SELECT and an INPUT.  In the case of a DropDownList a SELECT element seems more appropriate anyway.  Another Dojo showing this:

    http://dojo.telerik.com/UroFA/3

    I guess we will need to change our dropdown rendering to use an INPUT.
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 18 Mar 2015 Link to this post

    Hello CDC,

    The value attribute works for INPUT element, because it has value attribute (INPUT help). The SELECT element, however, does not have value attribute, hence it is just ignored by HTML.

    In this case, the best solution will be to use INPUT elements as it has value attribute.

    Regards,
    Georgi Krustev
    Telerik
     
    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