Hi,
Below Code is my Example of how my grid is binding but it is not binding the data but the data is coming in response
and when i bind the grid the below error occurs and grid is not binding
pqgrid.min.js:11 Uncaught TypeError: Cannot read property 'wdCenter' of undefined
at pq.cRenderBody.refreshColumnWidths (pqgrid.min.js:11)
at pq.cRenderBody.init (pqgrid.min.js:19)
at t.paramquery.cRefresh.refresh (pqgrid.min.js:12)
at pqgrid.min.js:12
at pqgrid.min.js:12
example
var $Associate_DocumentsGridPartial;
var colM = [];
var primaryColumn;
function bindAssociateDocumentGridPartial(standardID, tableName, clasName) {
var url = window.location.origin + "/Document/GetAllDocumentsAndAssociation";
var pData = { StandardID: standardID, TableName: tableName, ClasName: clasName };
primaryColumn = "ID";
$.post(url, pData, function (data, status) {
debugger;
var response = JSON.parse(data);
if (jQuery.isEmptyObject(response.data)) {
$("#DocumentListPartial").modal('hide');
return false;
}
colM = [];
colM.push({ title: '', dataIndx: 'ID', hidden: true });
colM.push({ title: '', dataIndx: 'TableName', hidden: true });
$.map(response.data.Table[0], function (v, k) {
if (k.toUpperCase() == "ISASSIGNED") {
colM.push({
title: '<b>' + toTitleCase(k) + '</b>', copy: false, dataIndx: k, halign: "center", width: 50, dataType: "integer", align: 'center', editable: true, menuIcon: false,
type: 'checkbox',
filter: { crules: [{ condition: "equal" }], options: [{ 0: 'UnCheck' }, { 1: 'Checked' }] },
cb:
{
all: true,
header: true,
check: 1,
uncheck: 0
},
editor: false
});
}
else if (k.toUpperCase().indexOf("DOCUMENT_TYPE_NAME") > -1) {
colM.push({ title: k, dataIndx: k, hidden: false, editor: false });
}
else {
colM.push({ title: k, dataIndx: k, hidden: true, editor: false });
}
})
bindGridDocumentClassAssociatione(colM, response.data.Table);
})
}
async function bindGridDocumentClassAssociatione(colM, data) {
debugger;
var obj = {
numberCell: { show: false },
minWidth: 500,
height: 450,
resizable: true,
title: "Grid From JSON",
strNoRows: 'No Rows Found',
showBottom: false,
scrollModel: { autoFit: true },
postRenderInterval: -1, // To get Updated row
trackModel: { on: true }, // To get Updated row
colModel: colM,
dataModel: {
data: data,
recIndx: primaryColumn
},
menuUI: {
tabs: ['filter'] //display only filter tab.
},
filterModel: {
on: true,
mode: "AND",
header: true,
menuIcon: true //show filter row icon initially.
},
};
$Associate_DocumentsGridPartial = $("#dvDocumentsGridPartial").pqGrid(obj);
$("#dvDocumentsGridPartial").pqGrid("refreshDataAndView");
}