1
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
This error usually occurs if jQuery and jQueryUI dependencies are not included.
Uncaught Error: cannot call methods on pqGrid prior to initialization; attempted to call method 'refreshDataAndView'
$(function () {
var pq = {
totalRecords: 0,
requestPage: 1,
pending: true,
rpp: 100, //records per request.
data: []
};
var obj = {
selectionModel: { type: 'row' },
scrollModel: {
autoFit: true
},
numberCell: { width: 60 },
title: "Infinite Scrolling",
virtualX: true, virtualY: true,
resizable: true,
beforeSort: function () {
pq.data = [];
pq.requestPage = 1;
},
beforeTableView: function (evt, ui) {
var finalV = ui.finalV,
data = pq.data;
if (ui.initV == null) {
return;
}
console.log('fire before table view');
if (!pq.pending && finalV >= data.length - 1 && data.length < pq.totalRecords) {
pq.requestPage++;
pq.pending = true;
//request more rows.
$(this).pqGrid('refreshDataAndView');
}
}
};
obj.colModel = [
{ title: "ID", dataIndx: 'id' },
{ title: "RecId", dataIndx: 'rec_id' },
{ title: "Orgstruct", dataType: "integer", align: "right", dataIndx: 'slc_orgstruct'},
{ title: "Gorizont", dataType: "string", align: "right", dataIndx: 'slc_gorizont'},
{ title: "Tblock", dataType: "string", align: "left", dataIndx: 'slc_tblock'},
{ title: "Gblock", dataType: "string", align: "left", dataIndx: 'slc_gblock'},
{ title: "Cal Date", dataType: "date", align: "left", dataIndx: 's0d_caldate', format:'dd.mm.yy'},
{ title: "Cal Year", dataType: "integer", align: "left", dataIndx: 's0d_calyear'},
{ title: "Cal Month", dataType: "integer", align: "left", dataIndx: 's0d_calmonth'},
{ title: "Index", dataType: "string", align: "left", dataIndx: 'slc_index'},
{ title: "Value", dataType: "float", align: "left", dataIndx: 'i00_value'}
];
obj.dataModel = {
data: pq.dataCache,
dataType: "JSON",
location: "remote",
method: 'POST',
sorting: 'remote',
sortIndx: 'company',
url: "/cascading/cascading/get-test-data",
postData: function () {
return {
pq_curpage: pq.requestPage,
pq_rpp: pq.rpp
};
},
getData: function (response) {
var data = response.data,
len = data.length,
curPage = response.curPage,
pq_data = pq.data,
init = (curPage - 1) * pq.rpp;
pq.pending = false;
pq.totalRecords = response.totalRecords;
for (var i = 0; i < len; i++) {
pq_data[i + init] = data[i];
}
return { data: pq_data }
},
error: function (jqXHR, textStatus, errorThrown) {
//alert(errorThrown);
}
};
$("#param-query-demo").pqGrid(obj);
});