【发布时间】:2015-12-06 22:41:07
【问题描述】:
我有一个剑道网格,当一个项目被选中时,我想修改底层数据项目,所以我正在这样做......
selectionChange: function(e)
{
var component = $(this.table).closest('.component');
var grid = this;
var val = !component.hasClass("secondary");
var selection = grid.dataItems(grid.select());
selection.forEach(function () {
this.set("SaleSelected", val);
});
}
我还有 2 个按钮可以让我在 2 个网格之间推动项目...
select: function (e) {
e.preventDefault();
var sender = this;
// get kendo data source for the primary grid
var source = $(sender).closest(".component")
.find(".component.primary")
.find(".details > [data-role=grid]")
.data("kendoGrid")
.dataSource;
// sync and reload the primary grid
source.sync()
.done(function () {
source.read();
my.Invoice.reloadGridData($(sender).closest(".component").find(".component.secondary").find(".details > [data-role=grid]"));
});
return false;
},
deselect: function (e) {
e.preventDefault();
var sender = this;
debugger;
// get kendo data source for the secondary grid
var source = $(sender).closest(".component")
.find(".component.secondary")
.find(".details > [data-role=grid]")
.data("kendoGrid")
.dataSource;
// sync and reload the primary grid
source.sync()
.done(function () {
source.read();
my.Invoice.reloadGridData($(sender).closest(".component").find(".component.primary").find(".details > [data-role=grid]"));
});
return false;
}
本质上,grid1 中的“选定项目”可以在服务器上标记为这样,然后重新加载网格以移动项目。
我觉得很好,但显然剑道有其他想法。
编辑数据项会导致其所属的网格重新绑定丢失选择状态,从而导致用户出现一些混乱的行为。
有没有办法告诉剑道“我现在要编辑这个未绑定的属性,不要搞乱绑定”?
【问题讨论】:
标签: javascript data-binding kendo-ui kendo-grid