I have individual 3 grids, separated by tabs (UI Tabs) and I was trying to refresh them with updated source data (XML data). I used the grid.refresh() method inside a SavedChanges() javaScript function, but it did not update the grid until I used the javascript window.location.reload() method.
Am I not using the grid.refresh() method correctly?? Below is my saveChanges function showing how I tried and failed to refresh my grids.
function saveChanges() {
if (!$.active && !grid.getEditCell().$cell && grid.isDirty() && grid.isValidChange({ allowInvalid: true }).valid) {
var gridChanges = grid.getChanges({ format: 'byVal' });
//debugger
$.ajax({
url: '/STS/Content/files/code/gridEdits.cfc', // for ColdFusion
data: {
method: "realtimeEdit",
list: JSON.stringify( gridChanges )
},
dataType: "json",
type: "POST",
async: true,
beforeSend: function (jqXHR, settings) {
grid.option("strLoading", "Saving..");
grid.showLoading();
},
success: function (changes) {
//commit the changes.
grid.commit({ type: 'add', rows: changes.addList });
grid.commit({ type: 'update', rows: changes.updateList });
grid.commit({ type: 'delete', rows: changes.deleteList });
},
complete: function () {
grid.hideLoading();
grid.option("strLoading", $.paramquery.pqGrid.defaults.strLoading);
grid.refresh();
grid2.refresh();
grid3.refresh();
// This method below works, but the entire html page is reloaded
//window.location.reload();
}
});
}
}