Not working. I'm now getting issues with grid.pqGrid("getXHR").abort(); and a console error saying "Cannot read properties of undefined (reading 'abort')"
If I remove the line of code, pqGrid code causes the same error below:
fn.remoteRequest = function(objP) {
objP = objP || {};
var that = this,
obj = that.getQueryString(objP),
url = obj.url,
dataURL = obj.dataURL;
if (that.loading) {
that.xhr.abort() // <<<<<<<<<<<<<<<< HERE
}
if (url) {
that.showLoading();
that.callXHR(url, dataURL, function(response, textStatus, jqXHR) {
that.onRemoteSuccess(response, textStatus, jqXHR, objP)
})
}
};
My data model is:
{
recIndx: "ID", // Key field
location: "remote", // Data source is remote
url: "list.php", // URL of list
dataType: "JSON", // Data format
method: "GET", // GET or POST
getData: function(dataJSON, textStatus, jqXHR){ return that.grid_after_get_data(dataJSON, textStatus, jqXHR); }
}
grid_after_get_data is inside another object:
grid_after_get_data: function(dataJSON, textStatus, jqXHR)
{
var data = dataJSON.data,
len = data.length,
curPage = dataJSON.page,
init = (curPage - 1) * this.grid_paging["rowsPerPage"];
this.grid.pqGrid("hideLoading");
// First page and record count
if(dataJSON["page"]==1 && typeof(dataJSON["totalRecords"])!=="undefined")
this.grid_paging["totalRecords"] = intval(dataJSON["totalRecords"]);
//copy rows from remote response to grid data cache.
for (var i = 0; i < len; i++) {
this.grid_paging["data"][i + init] = data[i];
}
// Spoof the array into thinking x amount of rows
this.grid_paging["data"].length = this.grid_paging["totalRecords"];
return { data: this.grid_paging["data"] }
},