В моем приложении есть Kendo TreeList и Kendo ComboBox. DataSource для TreeList также можно использовать для ComboBox. Если это возможно, это избавит меня от необходимости дважды запускать один и тот же запрос.
Кажется, это еще больше усложняется тем, что мой TreeList использует транспорт для операций CRUD.
Пример моего общего источника данных:
var sharedDataSource = new kendo.data.DataSource({
transport: {
read: function (e) {
webService.getData(arg1, arg2).then(function (response) {
e.success(response.data);
}, function (response) {
console.log(response);
});
}
}
});
sharedDataSource.read();
Транспортная часть моего TreeList:
transport: {
read: function (e) {
e.success(sharedDataSource);//sharedDataSource has NO data here. That's the problem
}
}
Поле со списком:
$("#comboBox").width(250).kendoComboBox({
dataTextField: "name",
dataValueField: "id",
dataSource: sharedDataSource//The comboBox is launched via a click after the page loads and DOES have data here
});