ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: swapnilsu on January 12, 2022, 06:56:33 pm
-
Hi Team,
When I have implemented PQ grid on my project its working fine for other functionality but when I have created new product by clicking on new product button the new row is inserted in grid and first cell showing in edited form its working fine but when i have changed edited cell to something different its getting issue Cannot read properties of undefined (reading 'pq_hidden')
below is the code
This is working with grid.editFirstCellInRow({ rowIndx: ri }); After try to remove the row
{
type: 'button', icon: 'ui-icon-plus', label: 'New Product', cls: 'newProductBtn', listener: function () {
if (checkUserSessionActive()) {
var grid = this;
var len = PhQty === undefined ? 1 : PhQty;
newRows = pqVS.data.filter(function (value) {
return value.deleteOption == true;
});
newRowsCount = parseInt(newRows.length) + parseInt( len);
if (newRowsCount<= 200) {
for (let i = 0; i <= len - 1; i++) {
var obj = grid.getViewPortIndx(),
initV = obj.initV;
//append empty row at beginning of viewport.
rowData = { "state": true, "RLSKU":0, "deleteOption": true, "newRow": true } //empty row
var ri = grid.addRow({ newRow: rowData, checkEditable: true, rowIndx: initV });
grid.scrollRow({ rowIndxPage: ri }, function () {
grid.editFirstCellInRow({ rowIndx: ri });
});
}
}
}
}
}
This code is getting issue with grid.editCell({ rowIndx: ri, dataIndx: "CITEMD" }) After try to remove the row
{
type: 'button', icon: 'ui-icon-plus', label: 'New Product', cls: 'newProductBtn', listener: function () {
if (checkUserSessionActive()) {
var grid = this;
var len = PhQty === undefined ? 1 : PhQty;
newRows = pqVS.data.filter(function (value) {
return value.deleteOption == true;
});
newRowsCount = parseInt(newRows.length) + parseInt( len);
if (newRowsCount<= 200) {
for (let i = 0; i <= len - 1; i++) {
var obj = grid.getViewPortIndx(),
initV = obj.initV;
//append empty row at beginning of viewport.
rowData = { "state": true, "RLSKU":0, "deleteOption": true, "newRow": true } //empty row
var ri = grid.addRow({ newRow: rowData, checkEditable: true, rowIndx: initV });
grid.scrollRow({ rowIndxPage: ri }, function () {
grid.editCell({ rowIndx: ri, dataIndx: "CITEMD" })
});
}
}
}
}
}
-
your code logic doesn't seem right. addRow, scrollRow, editFirstCellInRow methods should not be called in a loop.
addRow method can be used only once to insert multiple rows https://paramquery.com/pro/api#method-addRow
Please move the above methods outside of the loop and kindly share a jsfiddle if the issue is still not resolved.