我们正在使用带有angularjs的kendo网格,我试图动态更新列数据,但它没有更新列信息。以下是代码。
function loadSelectRowsGrid(gridData) {
var selectRowsGridID = "#rowsConfiguration-Grid";
var grid = $(selectRowsGridID).data("kendoGrid");
if (grid !== undefined && grid.dataSource.options.data !== null) {
grid.destroy();
}
pcService.rowConfiguration.configurationItem = [];
pcService.columnCollection.columns = [];
var maxColumnCount = 3
for (var i = 0 ; i <= maxColumnCount; i++) {
if (i != 0) {
//var columnObject = { "field": gridData.columnData[i].field };//+ "," + "title:" + localizationService.GetLocalizedText(gridData.columnData[i].field);
var columnObject = { "field": gridData.columnData[i].field, "title": localizationService.GetLocalizedText(gridData.columnData[i].field) };
pcService.columnCollection.columns.push(columnObject);
}
else {
}
}
$(selectRowsGridID).kendoGrid({
dataSource: {
data: gridData.gridData,
},
columns: pcService.columnCollection.columns, //gridData.columnData,
scrollable: false,
});
}
请帮助我动态更新列数据。
更新
我找到了发生这种情况的原因,因为我使用了kendo窗口,当我关闭弹出窗口时它仍然在DOM中。如何破坏kendowindow popup?以下是我的语法:
var selectRowsDialog = $("#select-Rows-dialog").kendoWindow({
width: "800px",
title: "Select rows",
autoOpen: false,
closable: true,
modal: true,
visible: false,
close: function () { }, }).data("kendoWindow").center().open();