ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: Balaji on November 18, 2016, 05:50:05 pm
-
Hi
Earlier I have used this code while using 2.x version. and Now I upgraded to 3.3 version. I am using getInstance Method of the grid in render function of the colModel. Now after upgrading , getInstance method is returning undefined.
Is this will work in 3.3 , how to handle?
{
title: "Open", dataType: "float", width: '95', resizable: false, dataIndx: "open", align: "right",
editable: function (ui) {
return disablePlus(ui);
},
render: function (ui) {
var grid = $(this).pqGrid('getInstance').grid
if (grid.isEditableCell({ rowIndx: ui.rowIndx, dataIndx: 'open' }) == false && ui.rowIndx == 1) {
grid.addClass({ rowIndx: ui.rowIndx, dataIndx: 'open', cls: 'blackcell' });
}
return (!isNaN(ui.cellData) && Number(ui.cellData) > 0) ? parseFloat(ui.cellData).toFixed(2) : "";
}
}
-
Context of callbacks is grid itself.
Please replace
var grid = $(this).pqGrid('getInstance').grid
with
var grid = this;
-
var Grid= this;
is working fine. I got the context.
But after that when i call the below method
grid.addClass({ rowIndx: ui.rowIndx, dataIndx: 'open', cls: 'blackcell' });
it is showing,
cannot call methods on pqGrid prior to initialization; attempted to call method 'addClass'.
Please check am i right or not.
-
Hi,
Issue with addClass was solved. I was looking incorrect. Without any changes the same code is working. Thank you for the valuable support.
Thank you.