Devextreme 调度程序将函数绑定到数据源?
Devextreme scheduler bind function to dataSource?
我有一个 ajax 调用和获取数据的函数。功能类似
function loadData(callback) {
//do ajax
if(callback) {
callback(data.data);
}
}
如何将此函数绑定到调度程序数据源?
试过这个
options: {
dataSource: loadData(function(data) {
return data;
});
}
并且当我在函数中执行 console.log
时它会 return 我需要的数据,但是如果我想添加其他选项,例如 views
它 期望;某处它不起作用
我如何实现这一点并使用数据呈现调度程序?
为了将远程数据绑定到 dxScheduler,我建议您使用 customStore 对象。
var dataSource = new DevExpress.data.DataSource({
load: function() {
// make ajax request here and return promise
}
});
$("#scheduler").dxScheduler({
//...
dataSource: dataSource
});
演示是here。
有关 DevExtreme 数据层的更多信息是 here。
我有一个 ajax 调用和获取数据的函数。功能类似
function loadData(callback) {
//do ajax
if(callback) {
callback(data.data);
}
}
如何将此函数绑定到调度程序数据源? 试过这个
options: {
dataSource: loadData(function(data) {
return data;
});
}
并且当我在函数中执行 console.log
时它会 return 我需要的数据,但是如果我想添加其他选项,例如 views
它 期望;某处它不起作用
我如何实现这一点并使用数据呈现调度程序?
为了将远程数据绑定到 dxScheduler,我建议您使用 customStore 对象。
var dataSource = new DevExpress.data.DataSource({
load: function() {
// make ajax request here and return promise
}
});
$("#scheduler").dxScheduler({
//...
dataSource: dataSource
});
演示是here。
有关 DevExtreme 数据层的更多信息是 here。