I cant set kendo dropdownlist selected item the way i want. so far this is what i tried , but it does not seems to work
<select name="YolTipleri" required
data-value-primitive="true"
data-role="dropdownlist"
data-text-field="Adi"
data-auto-bind="true"
data-value-field="GID"
data-source="Hede.Components.DataSources.YolTipi"></select>
i did try to set it like this but i am getting an error
$("#YolTipleri").data("kendoDropDownList").value(2);
and it give me error
Uncaught TypeError: Cannot read property 'value' of undefined
How can i set this value?
I cant set kendo dropdownlist selected item the way i want. so far this is what i tried , but it does not seems to work
<select name="YolTipleri" required
data-value-primitive="true"
data-role="dropdownlist"
data-text-field="Adi"
data-auto-bind="true"
data-value-field="GID"
data-source="Hede.Components.DataSources.YolTipi"></select>
i did try to set it like this but i am getting an error
$("#YolTipleri").data("kendoDropDownList").value(2);
and it give me error
Uncaught TypeError: Cannot read property 'value' of undefined
How can i set this value?
Share Improve this question edited Mar 16, 2018 at 13:02 Ömür Bilgili asked Mar 16, 2018 at 12:59 Ömür BilgiliÖmür Bilgili 1822 silver badges15 bronze badges 2- Have you taken a look at the documentation for Kendo DropDownList? – ShawnOrr Commented Mar 16, 2018 at 13:06
- Yes, but i can not find any sample for selected item when dynamic data binding. – Ömür Bilgili Commented Mar 16, 2018 at 13:08
2 Answers
Reset to default 2if you want the solution without writing the id you can use it
$('[name="YolTipleri"]').data("kendoDropDownList").value(2);
It might be just a typo, but I have kendo dojo working.
In first line you don't have id
selector, which are you using in jQuery
.
For MVVM
binding and dataSource you can use data-bind
attribute.
<select id="YolTipleri" name="YolTipleri" required
data-value-primitive="true"
data-role="dropdownlist"
data-text-field="Adi"
data-auto-bind="true"
data-value-field="GID"
data-bind="source: source">
</select>
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745478817a4629469.html
评论列表(0条)