Kendo ui 如何动态更新KendoUI网格中的其他行字段?

Kendo ui 如何动态更新KendoUI网格中的其他行字段?,kendo-ui,angularjs-directive,kendo-grid,Kendo Ui,Angularjs Directive,Kendo Grid,在我的KendoUI数据源中,我定义了以下内容: change: function (e) { if (e.action === "itemchange") { // auto-format Display As var geoDisplay, geoUrl; if (e.items[0].GeoState.length > 0) { geoDisplay = e

在我的KendoUI数据源中,我定义了以下内容:

    change: function (e) {
        if (e.action === "itemchange") {
            // auto-format Display As
            var geoDisplay, geoUrl;
            if (e.items[0].GeoState.length > 0) {
                geoDisplay = e.items[0].GeoCity + ", " + e.items[0].GeoState;
            } else {
                geoDisplay = e.items[0].GeoCity;
            }
            //this.dataItem(this.select()).GeoDisplay = geoDisplay;

            e.items[0].GeoCity = "updated: " + e.items[0].GeoCity;  // visually updates if editing this field
            e.items[0].GeoDisplay = geoDisplay;  // field is not updated
        }
        console.log("change: " + e.action);
        console.log(e);
        // do something else with e
    },
基本上,我想根据字段的输入更新正在编辑的行上的其他字段

在本例中,将更新地理城市。将触发
itemchange
事件,并且只有GeoCity字段使用新值更新。但是,我可以从数据中看到其他字段的数据已经更新

我尝试过使用.sync()和其他一些方法来显示这个,但到目前为止运气不佳

顺便说一句,我的网格是在AngularJS指令中定义的,它的
onEdit
事件不是我要查找的,因为我希望在更新每个字段时触发的事件,而不是整行


如何让其他字段进行可视化更新?

我在数据源代码中添加了以下代码,从而解决了这个问题:

    change: function (e) {
        if (e.action === "itemchange") {
            // auto-format Display As
            var thisRow = $("#accountGeoLocationEditorGrid tbody").find(".k-grid-edit-row");

            // update geo display 
            if (e.field === "GeoCity" || e.field === "GeoState") {
                var geoDisplay, geoUrl;
                if (e.items[0].GeoState.length > 0) {
                    geoDisplay = e.items[0].GeoCity + ", " + e.items[0].GeoState;
                } else {
                    geoDisplay = e.items[0].GeoCity;
                }

                if (e.items[0].GeoDisplay.length == 0) {
                    e.items[0].GeoDisplay = geoDisplay;
                    thisRow.find("input[name=GeoDisplay]").val(geoDisplay);
                }
            }
        }
我真的在寻找另一种方法来实现这一点,因为我真的不想在定义的数据源中进行DOM查找等


欢迎其他建议。

您是否尝试了网格
刷新()
方法?在
change
事件中的更改结束时,调用此行(使用网格的正确id):

我已经在我的网格和剑道的样本上测试过了,它像这样工作得很好。您正在编辑数据源,但网格不知道您所做的额外更改,已编辑的单元格除外。调用refresh将更新网格上的所有单元格以反映数据源

$("#grid").data("kendoGrid").refresh();