私のアプリケーションには、剣道ツリーリストと剣道コンボボックスがあります。 TreeListのDataSourceをComboBoxに使用することもできます。これが可能であれば、同じクエリを2度実行する必要がなくなります。剣道データソースをComboBoxとTreeListの間で共有する
これは、私の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
});