.NET Kendo Scheduler:动态更改数据源资源 [英] .NET Kendo Scheduler: dynamically change datasource resources

查看:295
本文介绍了.NET Kendo Scheduler:动态更改数据源资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我正在使用这样的数据源:(带有用于过滤硬编码的参数)

Now i'm using a datasource like this: (with the parameters to filter hard coded)

   $(function () {
        $("#scheduler").kendoScheduler({
            date: new Date(Date.now()),
            startTime: new Date(2013, 5, 13, 9, 0, 0, 0),
            height: 800,
            timezone: "Etc/UTC",
            group: {
                resources: ["Rooms"]
            },
            resources: [
                {
                    name:"Rooms",
                    title: "Room",
                    field: "RoomID",
                    dataSource: {
                        transport:
                            {
                                read: { url: "@Html.Raw(Url.Action("Filter_Rooms", "Room", new{
                                    pPar1= true,
                                    pPar2 = false,
                                    pPar3 = true,
                                         }))", dataType: "json" }
                            }
                    }
                }

如您所见,这些参数仍然是硬编码的,我想在用户希望使用复选框时更改它们:

As you can see these paramaters are still hard coded and I want to change them whenever the user wants using checkboxes:

<div class="checkbox">
    <label>
    <input id="chkPar1" type="checkbox"> Parameter 1
    </label>
</div>
<div class="checkbox">
    <label>
    <input id="chkPar2" type="checkbox"> Parameter 2
    </label>
</div>   
    <a href="#" id="btnFilter" class="btn btn-outline btn-primary btn-lg btn-block">Filter</a>

我想在使用javascript检查按钮是否被单击时,然后将复选框参数存储在全局变量中,并在调度程序的传输读取中使用它们,但看来您不能在此处使用document.getelementbyId.

I thought while using javascript to check if button is clicked and then store checkbox paramaters in global variables and use these in the transport read of the scheduler but it seems you can't use document.getelementbyId here.

在这里,他们建议 Kendo UI动态更改数据源字符串(XML)但这似乎也不适合我..

Here they suggested Kendo UI Dynamically Change Datasource String (XML) but that doesn't seem to work for me neither..

var dynamicUrl = "Html.Raw(Url.Action('Filter_Rooms', 'Room', new{pFilter = true, pCapacity = 25,pBeamer = true,pTelevision = false}))', dataType: 'json'"
var scheduler = $("#scheduler").data("kendoScheduler");
scheduler.dataSource.transport.options.read.url = dynamicUrl;

那么,如何动态更改这些参数或更新整个传输读取URL?

So How can I dynamically change these paramaters or update the entire transport read url?

致谢

推荐答案

不确定它是否正是您所追求的,但是一个很好的参考框架可能是

Not sure if it's exactly what you're after, but a good frame of reference might be this example project. It very simply shows how to load new content when you change the view. You may be able to adapt it.

这篇关于.NET Kendo Scheduler:动态更改数据源资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆