Kendo ui 当剑道网格中的单个单元格数据发生更改时,如何防止整个网格刷新?
虽然我们可以使用虚拟化或分页来加快刷新速度,但每次数据更改的整个网格刷新一点也不好。有没有办法避免这种情况 当绑定对象中的多个数据发生更改时,情况会变得更糟,网格会因每次更改而刷新,这也不好Kendo ui 当剑道网格中的单个单元格数据发生更改时,如何防止整个网格刷新?,kendo-ui,kendo-grid,Kendo Ui,Kendo Grid,虽然我们可以使用虚拟化或分页来加快刷新速度,但每次数据更改的整个网格刷新一点也不好。有没有办法避免这种情况 当绑定对象中的多个数据发生更改时,情况会变得更糟,网格会因每次更改而刷新,这也不好 function PresonDetails(_contactName, _contactTitle, _country, _companyName) { Object.defineProperties(this, { "ContactName": { get: function
function PresonDetails(_contactName, _contactTitle, _country, _companyName) {
Object.defineProperties(this, {
"ContactName": {
get: function () {
return this._contactName;
},
set: function (value) {
this._contactName = value;
},
enumerable: true,
configurable: true
},
"ContactTitle": {
get: function () {
return this._contactTitle;
},
set: function (value) {
this._contactTitle = value;
},
enumerable: true,
configurable: true
},
"Country": {
get: function () {
return this._country;
},
set: function (value) {
this._country = value;
},
enumerable: true,
configurable: true
},
"CompanyName": {
get: function () {
return this._companyName;
},
set: function (value) {
this._companyName = value;
},
enumerable: true,
configurable: true
}
});
this.ContactName = _contactName;
this.ContactTitle = _contactTitle;
this.Country = _country;
this.CompanyName = _companyName;
}
(function () {
var details = [];
details.push(new PresonDetails("ContactName1", "ContactTitle", "USA", "MICro"));
var refresh = window.kendo.ui.Grid.fn.refresh;
window.kendo.ui.Grid.fn.refresh = function () {
alert("Grid Refresh");
refresh.call(this,arguments);
}
var $grid = $('#grid');
$grid.kendoGrid({
scrollable: true,
dataSource: details,
groupable: false,
sortable: false,
editable: true,
columns: [{
field: "ContactName",
title: "Contact Name",
width: 200
}, {
field: "ContactTitle",
title: "Contact Title",
width: 250
}, {
field: "CompanyName",
title: "Company Name"
}, {
field: "Country",
width: 150,
}]
});
})();
以下是阻止网格数据绑定事件将停止刷新的:
funnction avoidRefresh(e) {
e.preventDefault();
}
// stop refresh
grid.bind("dataBinding", avoidRefresh);
// allow refresh
grid.unbind(avoidRefresh);