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

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

5 Answers 283 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Aparna
Top achievements
Rank 1
Aparna asked on 11 Oct 2012, 09:16 PM
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



 

 

 

5 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 18 Oct 2012, 03:54 PM
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!
0
Aparna
Top achievements
Rank 1
answered on 23 Oct 2012, 04:11 PM
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
0
Alexander Valchev
Telerik team
answered on 24 Oct 2012, 04:21 PM
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!
0
Hardeep
Top achievements
Rank 1
answered on 27 Sep 2013, 04:30 PM
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
0
Alexander Valchev
Telerik team
answered on 02 Oct 2013, 07:52 AM
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!
Tags
MVVM
Asked by
Aparna
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Aparna
Top achievements
Rank 1
Hardeep
Top achievements
Rank 1
Share this question
or