jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Refresh grid after ajax save
This topic contains 1 reply, has 2 voices, and was last updated by Dimitar 11 years, 2 months ago.
-
Author
-
Hi,
How will I refresh the grid on saving through ajax call:
`var dailyData =DayColGridDataField;
var dailysrc =
{
datatype: “json”,
datafields:daydataFieldColumns,localdata: dailyData,
url: ‘jqxgridDaily.htm’,
};
$(“#jqxgridDaily”).jqxGrid(
{
width: 1015,
pagesizeoptions: [’10’, ’15’, ’20’],
pagesize: 15,
source: dataAdapter,
autoheight: true,
sortable: false,
pageable: true,
altrows: true,
editable: true,
enabletooltips: true,
theme: ‘energyblue’,
showstatusbar: true,
statusbarheight: 25,
showaggregates: true,
columnsheight: 50,
columnsresize: true,
selectionmode: ‘multiplecellsadvanced’,
columns:daygridColumns
});
$(“#btnDailySave”)
.click(
function() {
$.ajax(
{
url : “saveDailyEntry.htm,
cache : false,
type : “POST”,
contentType:’application/json;charset=utf-8′,
async : false,
dataType : “json”,
data : JSON.stringify(editedRow)
})
.done(
function(data) {
alert(“Daily based TS Entry data saved essfully.”);
$(
‘#jqxgridDaily’)
.trigger(
‘reloadGrid’);
}).fail(function() {
alert(“Daily based TS Entry not saved. Please try after some time”);
});
<strong>dailysrc.localdata = dailyData;
$(“#jqxgridDaily”).jqxGrid(‘updatebounddata’);
dataAdapter.dataBind();</strong>
}
}});
});`Hello ssp,
The updatebounddata and the other code you put after the Ajax call should be called in the done callback function. This way, you will be sure the data source has finished updating before re-binding the grid.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.