1

我设置了一个剑道网格,以便网格的 onChange 事件(记录选择)将填充一些对用户稍后将执行的操作至关重要的 ko var。

一个特殊的例子是当用户扩展一行时,我们去一个服务来获取该记录的详细数据。

这在大约 90% 的情况下都有效,但是剑道网格能够(不时地!!!)在不选择该行的情况下扩展详细信息行。您必须恰到好处地点击向下钻取按钮,但这是可能的。

我需要阻止这种行为,或者破解它,以便我可以触发那个 onChange。在 detailInit 中,我确实在没有运气的情况下在行上触发了 select()...

我可以从 expand() 或 detailInit() 中进行一些选择,但我宁愿只触发 onChange()。为任何事情准备...

一个例子:

getGrid: function (selector, dataSource) {
            return $(selector).kendoGrid({
                dataSource: dataSource,
                change: this.offenderVictimGridChange,
                selectable: "single",
                sortable: true,
                resizable: true,
                scrollable: {
                    virtual: true,
                },
                detailTemplate: kendo.template($("#offender-detail-template").html()),
                detailInit: this.victimOffenderDetailInit,

…………

    offenderVictimGridChange: function (args) {
                dataContext.selectedOffender(this.dataItem(this.select()));


 },

…………

在victimOffenderDetailInit() 中,我需要dataContext.selectedOffender(),这就是整个问题。

dataContext.selectedOffender() 在更改时设置(90% 的时间在打开记录时触发)。

4

0 回答 0