I have the following ajax script.
$.ajax({
url: url,
type: "DELETE",
dataType: "text",
success: function (data) {
var grid = $('#rolesgrid').ejGrid("instance");
grid.refreshContent();
$('#rolesgrid_delete').css('visibility', 'hidden');
renameConditionType(grid);
},
error: function (xhr, textStatus, errorThrown) {
showDialogMessage('Page error', errorThrown, 'danger');
}
});
Method renameConfitionType change content of last column.
function renameConditionType(grid){
var gridRows = grid.getRows();
var columnIndex = grid.getColumnIndexByField("ConditionType");
for (var i = 0; i < gridRows.length; i++) {
if (gridRows[i].children[columnIndex].innerHTML === '1'){
$(gridRows[i].children[columnIndex]).html('AND');
}
else if (gridRows[i].children[columnIndex].innerHTML === '0'){
$(gridRows[i].children[columnIndex]).html('OR');
}
}
}
When I make request by calling function grid.refreshContent(). The next function renameConditionType(grid) is called. This second change context of specific column.
When request from function grid.refreshContent() is finished. It overwrites the result of function renameConditionType(grid).
How to make in order to wait when request from function grid.refreshContent(). I use syncfusion javascript grid.