我正在使用Kendo UI绑定嵌套网格。每当我更新父网格时,其子网格也会随之更新。有什么方法可以编辑父网格并且它的子网格不受影响。我正在使用C#Asp.net
<script>
function onDataBound(e) {
this.expandRow(this.tbody.find("tr.k-master-row"));
}
function initDetail(e) {
var grid = $("#CustomerDetail_" + e.data.CustomerId).data("kendoGrid");
grid.dataSource.data([e.data]);
}
</script>
@(Html.Kendo().Grid<DetailGridSample.Models.TestData>()
.Name("grid")
.Editable(editable => editable
.Mode(GridEditMode.InCell)
)
.Columns(columns =>
{
columns.Bound(e => e.CustomerId).Width(120);
columns.Bound(e => e.Customer).Width(120);
columns.Bound(e => e.CustomerGroup).Width(120);
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("LoadData", "Home"))
.Model(
model =>
{
model.Id(t => t.CustomerId);
}
)).ClientDetailTemplateId("detailTemplate")
.Events(events => events.DetailInit("initDetail"))
)
<script id="detailTemplate" type="text/kendo">
@(Html.Kendo().Grid<DetailGridSample.Models.TestData>()
.Name("CustomerDetail_#=CustomerId#")
.Editable(editable => editable
.Mode(GridEditMode.InCell)
)
.Editable(editable => editable
.Mode(GridEditMode.InCell)
)
.AutoBind(false)
.Columns(columns =>
{
columns.Bound(e => e.CustomerInvoice1).Width(120);
columns.Bound(e => e.CustomerInvoice2).Width(120);
columns.Bound(e => e.CustomerInvoice3).Width(120);
})
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.Model(
model =>
{
model.Id(t => t.CustomerId);
}
)).ToClientTemplate()
)
</script>
在编辑父网格之前