我在kendo窗口模板中有一个kendo网格。网格从主UI上的另一个网格获取其数据。基本上,我有一个基金的模型层次结构 - >货币 - >分配。主UI网格填充了整个数据,基金有一个详细模板,显示其货币及其分配。
现在,让我给出一些代码片段:
主网格:
<div kendo-grid="ctrl.fundGrid" style="margin-top: 2em" k-options="ctrl.fundGridOptions" k-scope-field="kgrid" id="myGrid" k-height='600'></div>
编辑窗口模板:
<script id="edit-template" type="text/x-kendo-template">
<div class="container">
<div kendo-grid="ctrl.currencyKendoGrid" ng-show="ctrl.IsVisible" style="margin-top: 2em" id="myGrid" k-options="ctrl.currencyGridOptions">
<div k-detail-template>
<div id="allocGrid" kendo-grid k-options="ctrl.allocationGridOptions(dataItem)" ng-show="dataItem.FundCurrencyId!=0"></div>
</div>
</div>
</div>
配置编辑窗口模板的可编辑配置:
editable: {
mode: "popup",
template: kendo.template($("#edit-template").html()),
//confirmation: "Are you sure you want to delete this fund?",
window: {
title: "Edit Fund Details",
animation: false,
height: "800",
width: "1200"
}
},
主要网格编辑事件:
edit: function (e) {
if (e.model.Currencies)
ctrl.currencyKendoGrid.dataSource.data(e.model.Currencies);
}
货币网格dataSource读取配置如下:
dataSource: {
transport: {
read: function (e) {
e.success();
},
}
}
货币网格是可编辑的,并配置了编辑,销毁命令。但是,当我内联编辑货币行,然后取消行编辑而不是更新时,该行不会将货币数据恢复到其原始状态。有人可以帮我理解是什么让剑道网格在取消时恢复其状态,以及我的剑道网格究竟出现了什么问题?
答案 0 :(得分:0)
我遇到的情况是我需要始终隐藏网格中某些行的“删除”按钮。单击“取消”按钮后,“删除”按钮将重新出现。这就是我为解决这个问题所做的工作:
$(document).on("click", ".k-grid-edit", function () {
var cancelbtn = $(".k-grid-cancel");
cancelbtn.each(function () {
var _this = $(this);
_this.attr("onclick", "cancelEdit()");
});
});
function cancelEdit() {
$("#MyGrid").data("kendoGrid").dataSource.read();
}