gpt4 book ai didi

javascript - Kendo UI Grid取消不恢复原始数据

转载 作者:行者123 更新时间:2023-11-28 06:36:39 26 4
gpt4 key购买 nike

我在剑道窗口模板内有一个剑道网格。网格从主 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: {
transport: {
read: function (e) {
e.success();
},
}
}

货币网格是可编辑的,并且配置了编辑、销毁命令。但是,当我内联编辑货币行,然后取消行编辑而不是更新时,该行不会将货币数据恢复到原始状态。有人可以帮助我了解是什么使剑道网格在取消时恢复其状态,以及我的剑道网格到底有什么问题吗?

最佳答案

我遇到过一种情况,我需要始终隐藏网格中某些行上的“删除”按钮。单击“取消”按钮后,“删除”按钮将重新出现。这就是我为解决这个问题所做的:

    $(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();
}

关于javascript - Kendo UI Grid取消不恢复原始数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34225832/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com