Data-value-field does not work in Multiple selection Listbox

6 posts, 0 answers
  1. Aparna
    Aparna avatar
    16 posts
    Member since:
    May 2012

    Posted 11 Oct 2012 Link to this post

    HI,

    I have the following code :
    <select id="mlstProdTypes" multiple data-bind="source: prodTypesList, value: filter.prodTypes"
               data-text-field="name" data-value-field="id" class="prodTypesList"></select>




    filter.prodTypes is defined as []. Even though I have specified data-value-field, selectedItem { name: "", id: "" }  added to filter.prodTypes instead of adding only the "id"

    Please help how to get back only the selected item's data-value-field instead of the selected item ....

    Thanks
    Aparna



     

     

     

  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2895 posts

    Posted 18 Oct 2012 Link to this post

    Hi Aparna,

    data-value-field and data-text-field are properties of the Kendo widgets and cannot be used with standard html elements. The html element bindings are demonstrated here.

    Regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Aparna
    Aparna avatar
    16 posts
    Member since:
    May 2012

    Posted 23 Oct 2012 Link to this post

    Hi Valchev

    Thanks for responding. So is there no way to specify display property and value property incase of HTML bindings ? Note in my example, only Name is getting displayed but for value, instead of storing a specific property entire selected object is getting stored ....

    Thanks
    Aparna
  4. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2895 posts

    Posted 24 Oct 2012 Link to this post

    Hi Aparna,

    I made a mistake, please accept my apology for the inconvenience caused.
    Actually the data-text-field and data-value-field are supposed to work with <select> elements. Here is a short example that demonstrates the implementation of such scenario:

    The values will be still stored as objects, but you can retrieve the value (or text) field through a function.

    Regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Hardeep
    Hardeep avatar
    5 posts
    Member since:
    Jul 2013

    Posted 27 Sep 2013 Link to this post

    Hi Alexander,

    Is it possible to multiple selection with single click without holding ctrl key?

    E.g. Click on it select it..then click on second item and select it without loosing first selection?


    Thank you.
    Best Regards
  6. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2895 posts

    Posted 02 Oct 2013 Link to this post

    Hello Hardeep,

    Kendo MVVM does not modify the way standard select multiple HTML element behaves. By default multiple selection is performed by holding the ctrl key:
    Changing the native behavior is not supported.

    Regards,
    Alexander Valchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top