我制作了一个简单的网格(可排序),并在其中添加了一些记录。当我删除所有记录然后如果我点击任何列进行排序它会取回所有记录,即使我删除所有记录
这就是我正在做的事情
$(document).ready(function () {
var dataitem = {};
var grid = $('#mygrid').kendoGrid({
dataSource: {data : [{
status: 'On',
description: 'a longer description'
}, {
status: 'On',
description: 'a longer description'
}, {
status: 'On',
description: 'a longer description'
}, {
status: 'On',
description: 'a longer description'
}, {
status: 'On',
description: 'a longer description'
}, {
status: 'On',
description: 'a longer description'
}]},
width: 250,
height: 200,
sortable:true,
columns: [{
field: "status"
}, {
field: "description",
title: "Description"
}, {
command: [{
name: "delete",
text: "delete",
click: _handleDelete,
imageClass: "ui-icon ui-icon-close"
}],
title: " ",
width: "100"
}]
}).data('kendoGrid');
var kWindow = $('#window').kendoWindow({
width: "500px",
title: "Delete dialog",
visible: false
}).data('kendoWindow');
$('.yesbtn').click(function () {
console.log('My message');
grid.dataSource.remove(dataitem);
kWindow.close();
});
$('.nobtn').click(function () {
console.log('My other message');
dataitem = {};
kWindow.close();
});
function _handleDelete(event) {
dataitem = grid.dataItem($(event.currentTarget).closest("tr"));
kWindow.open();
};
});
答案 0 :(得分:0)
注意到其他人也面临同样的问题,这是库中的一个错误,他们修复了最新版本。所以,我刚刚更新了版本及其修复版。