Мое приложение имеет Kendo TreeList и Kendo ComboBox. DataSource для TreeList также может использоваться для ComboBox. Если это возможно, это помешает мне выполнить один и тот же запрос дважды.Kendo Share DataSource Между ComboBox и TreeList
Это, по-видимому, сложнее, чем мой TreeList, используя транспорт для операций CRUD.
Пример моей общей DataSource:
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:
$("#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
});