【问题标题】:Angular Kendo scheduler refreshAngular Kendo 调度程序刷新
【发布时间】:2015-05-04 22:27:08
【问题描述】:

我有一个剑道角度调度器如下:

var kendoDataSource = new kendo.data.SchedulerDataSource({
    schema: {
        model: {
            fields: {
                id:{defaultValue:2}
            } 
        }
    },
});


$scope.schedulerOptions = {
    date: new Date(),
    height: 450,
    views: ["day", "week", "month", "agenda"],
    editable: { template: $("#editor").html() },
    dataSource: {
        batch: true,
        transport: {
            read: {
                url: "http://192.168.1.121:8000/pp/getevent/"+$rootScope.selectedstud.pk,
                dataType: "json"
            }
        }
    }
};

我的html如下:

<div kendo-scheduler="grid" k-options="schedulerOptions" id="schedule">
     <span k-event-template class='custom-event'>{{dataItem.title}}</span>
     <div k-all-day-event-template class='custom-all-day-event'>{{dataItem.title}}</div>
</div>

我正在尝试根据我在 read() 中传递的选择来刷新网格内的数据。我该怎么做?

【问题讨论】:

  • 在你的 dataSource 定义中,将 data 选项包含为一个 js 函数。它应该为您的数据源 url 参数返回一个对象。 $scheduler.data("kendoScheduler").dataSource.read();
  • 不知何故,当我将我的传输放在选项之外的数据源中时,它没有获取我的数据!
  • 不包括read参数吗?

标签: javascript angularjs kendo-ui kendo-scheduler


【解决方案1】:

这将与此设置一致。我还没有测试过,但它应该可以工作。当您调用 read 方法时,它将包含数据函数返回对象。祝你好运。

$scope.schedulerOptions = {
date: new Date(),
height: 450,
views: ["day", "week", "month", "agenda"],
editable: { template: $("#editor").html() },
dataSource: {
    batch: true,
    transport: {
        read: {
            url: "http://192.168.1.121:8000/pp/getevent/"+$rootScope.selectedstud.pk,
            dataType: "json",
            data: "additionalParams"
        }
    }
}
};

function addtionalParams(){ return { param1: 1, param1: 2}; } 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-12
    • 1970-01-01
    • 2017-02-24
    • 2014-12-08
    • 2014-07-28
    • 2016-10-24
    相关资源
    最近更新 更多