且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从detailInit获取所选行的ID,然后折叠detailInit并将所选数据放入父网格?

更新时间:2023-12-03 16:22:40

您可以使用detailExpand事件获取主行和id值.

You can use detailExpand event to get master row and id value.

var globalGroupId = null;

detailExpand: function(e) {
   console.log(e.masterRow, e.detailRow);
   var globalGroupId = e.masterRow.get("globalGroupID");
}

然后为您的详细信息网格添加更改方法,然后完成窍门

Then add change method for you detail grid and there do the trick

change: function(e) {

    // get detail row
    var detailRow = this.dataItem(this.select());
    var shipCountry = detailRow.get("ShipCountry")

    // get master row
    var masterGrid = $("#grid").getKendoGrid();
    var masterRow = masterGrid.dataSource.get(employeeId);

    // set 'ship country' value to master row 'Country' field
    masterRow.set("Country", shipCountry);

},

查看此 Dojo