【问题标题】:Kendo Grid change event firing issue(fired two times when i click one row)剑道网格更改事件触发问题(单击一行时触发两次)
【发布时间】:2013-04-21 11:45:58
【问题描述】:

剑道用户界面网格 我在网格上附加了更改事件,但是每次单击一行时它都会提醒两次。

function onChange(arg) {
    var selected = $.map(this.select(), function (item) {
        return $(item).text();
    });
    alert(selected.join(", "));
}

网格代码

@(Html.Kendo().Grid<ETender.Mvc.Models.Region>()
                .Name("country")
                    .Columns(columns =>
                    {
                        columns.Bound(r => r.ID);
                        columns.Bound(r => r.CNAME);
                        columns.Bound(r => r.ENAME);
                    })
                    .Sortable()
                    //.Scrollable(scrollable => scrollable.Virtual(false).Height(500))
                    .Selectable()
                    .Pageable()
                    .Reorderable(reorder => reorder.Columns(true))
                    .Resizable(resize => resize.Columns(true)) 
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .ServerOperation(true)
                        .Events(ev => ev.Error("loadError"))
                        .Model(m =>
                        {
                            m.Id(p => p.ID);
                            m.Field(p => p.ID).Editable(false);
                        })
                        .Read(read => read.Action("GetRegionList", "Region")
                            .Data("function() { return {         CountryID:'0',ProvinceID:'0',CityID:'0',RegionType: 'Country'}; }")
                            )
                    )
                     .Events(events => events.Change("onChange"))

                )

谁有解决办法。

【问题讨论】:

    标签: jquery asp.net-mvc user-interface kendo-ui


    【解决方案1】:

    基本上,此行为是由于出于调试目的使用“alert”方法引起的 - 请注意,不建议这样做,因为在与焦点元素交互时可能会导致意外行为。替换“alert”方法并使用“debugger”命令或“console.log()”函数后,更改事件将按预期工作。

    【讨论】:

    • sorry Vlad...事件仍然使用 console.log() 触发两次。 window.alert() 与它无关。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多