Kendo Scheduler mvc双击显示kendo窗口

时间:2015-12-03 07:14:55

标签: jquery kendo-ui telerik kendo-scheduler kendo-ui-mvc

我想在我的调度程序中双击单元格以弹出我的kendo-window而不是单击。因为每次我点击我的调度程序时,kendo-window总是弹出,即使我点击了月和日视图.. ..

任何评论都表示赞赏。

查看

<script>

    function scheduler_change(e) {


        var b = e.events;
        var a = e.start;

            $.get("@Url.Content("~/Scheduler/GetPartialview")", { date: e.start, id: empID }, function (r) {
                $("#EmployeeStatus").html(r)
                e.preventDefault();
                $("#EmployeeStatus").data("kendoWindow").center().open()
            })
        }

</script>
    @(Html.Kendo().Scheduler<StaffLocator.BusinessLayer.Models.EmployeeStatus>()
                    .Name("scheduler")
                    .Date(DateTime.Today)
                    .StartTime(new DateTime(2015, 11, 11))
                    .EndTime(new DateTime(2015, 11, 11))
                    .Editable(editable => editable.Update(false)
                                          .Create(false)
                                          .Destroy(false)
                                          //optionally disable creating new events*/
                     )
                    .Selectable(true)
                    .Events(e =>
                            {
                                e.Change("scheduler_change");
                            })

                    .AutoBind(false)


                    .Views(views =>
                    {
                        views.MonthView();
                        views.AgendaView();
                    })



                           .Read("readStart", "Home")
                           //.Create("SaveNew", "EmployeeStatus")
                           //.Destroy("Destroy", "Home")
                           //.Update("Update", "Scheduler")
                    // .ShowWorkHours(false)
                     //   .BindTo(false)
                    )

            )

 @(Html.Kendo().Window()
        .Name("EmployeeStatus")
        .Title("Employee Status")
        .Draggable()

        .Resizable()
        .Width(500)
        .Height(350)
        .Modal(true)
            // .Visible(false)
            .Visible(!ViewData.ModelState.IsValid) 
    )

1 个答案:

答案 0 :(得分:0)

请尝试使用以下代码段。

<script>
    $(document).ready(function () { 
        scdulerCurrentView = $("#scheduler").data("kendoScheduler").view().title;

    });
    var scdulerCurrentView = '';
    function scheduler_change(e) {
        if (scdulerCurrentView == this.view().title) {
            $("#EmployeeStatus").data("kendoWindow").center().open();
        }
        else {
            scdulerCurrentView = this.view().title;
        }
    }

</script>

如果有任何疑虑,请告诉我。