function getPersistData(){
. . . . . . .
if (data) {
gridInst.setProperties({
sortSettings: { columns: data.sortSettings.columns },
}, true)
gridInst.setProperties({
columns : data.columns,
})
}
}
|
setTimeout(function(){
gridInst.setProperties({
columns: data.columns,
})
}, 20)
|
function getPersistData(){
var gridInst = document.getElementsByClassName("e-grid")[0].ej2_instances[0];
var getPersistedData= JSON.parse(window.localStorage.getItem("gridPersistData"));
var data= JSON.parse(getPersistedData);
if (data) {
gridInst.setProperties({
// to prevent the two request
groupSettings: {columns:data.groupSettings.columns},
sortSettings: { columns: data.sortSettings.columns },
filterSettings: data.filterSettings,
pageSettings: {pageSize:data.pageSettings.pageSize, currentPage:data.pageSettings.currentPage, pageCount: data.pageSettings.pageCount},
searchSettings: {fields:data.searchSettings.fields, key:data.searchSettings.key}
}, true)
gridInst.groupModule.updateGroupDropArea(true);
for(var i =0; i<data.groupSettings.columns.length; i++){
gridInst.groupModule.addColToGroupDrop(data.groupSettings.columns[i])
}
gridInst.setProperties({
columns: data.columns,
})
}
}
|
public ngOnInit(): void {
this.grid.getCurrentViewRecords = function () {
return (this.allowGrouping && this.groupSettings.columns.length && this.currentViewData.length && (this.currentViewData as Object[] & { records: Object[] }).records) ?
(this.currentViewData as Object[] & { records: Object[] }).records : this.currentViewData;
}
}
|