Hi everybody,
i am starting to use kendo ui mobile and i have a problem.
I am trying to link a html select to a remote datasource.
my html:
<select id="fromto-activity" data-value-field="id" data-text-field="name" data-bind="source: activitiesDataSource, value: selectedActivity"></select>
my javascript:
var viewModel = kendo.observable({
activitiesDataSource:new kendo.data.DataSource({
transport: {
read: {
url: WEB_SERVICE_URL + "activities",
dataType: "json"
}
}
}),
selectedActivity: "2"
});
kendo.bind($("#fromto-activity"), viewModel);
the service returns json:
[{"id":1,"name":"Name1"},{"id":2,"name":"Name2"}]
The select element is filled with the data of the service.
The Problem is, that the value selectedActivity isn't bound to the select element.
When I add data-role="dropdownlist", everything works fine. But I don't want that, because I want to develop a mobile app and want to use the html select element with his styling.
When I don't use a remote data source, then everything works fine too. For example with this datasource:
activitiesDataSource:[
{ id: 1, name: "Name1" },
{ id: 2, name: "Name2" },
{ id: 3, name: "Name3" }];
Could anybody tell me, what's mistake?
],
i am starting to use kendo ui mobile and i have a problem.
I am trying to link a html select to a remote datasource.
my html:
<select id="fromto-activity" data-value-field="id" data-text-field="name" data-bind="source: activitiesDataSource, value: selectedActivity"></select>
my javascript:
var viewModel = kendo.observable({
activitiesDataSource:new kendo.data.DataSource({
transport: {
read: {
url: WEB_SERVICE_URL + "activities",
dataType: "json"
}
}
}),
selectedActivity: "2"
});
kendo.bind($("#fromto-activity"), viewModel);
the service returns json:
[{"id":1,"name":"Name1"},{"id":2,"name":"Name2"}]
The select element is filled with the data of the service.
The Problem is, that the value selectedActivity isn't bound to the select element.
When I add data-role="dropdownlist", everything works fine. But I don't want that, because I want to develop a mobile app and want to use the html select element with his styling.
When I don't use a remote data source, then everything works fine too. For example with this datasource:
activitiesDataSource:[
{ id: 1, name: "Name1" },
{ id: 2, name: "Name2" },
{ id: 3, name: "Name3" }];
Could anybody tell me, what's mistake?
],