ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: joaosales on February 08, 2018, 05:20:30 pm
-
Hi,
Is there a easier way to copy data from one cell to the rest of the cells of columns after, in the same row?
For now i was doing inside the change event. Whenever a value is changed, i get the
ui.updateList and the values at newRow and rowData and copy the value in newRow to the remaining columns at rowData.
and then $grid.pqGrid("updateRow", { 'rowIndx': updatedRowIndx , row: rowData })
function UpdateColumns( event, ui ) {
let changes = ui.updateList[0];
let rowChange = changes.newRow;
let newRow = changes.rowData;
//get updated cell and loop at newRow changing the value of the other columns
this.updateRow({ 'rowIndx': changes.rowIndx , row: newRow });
}
Update the question with the code because it didn't actually work :(
Thanks
-
You haven't shared full source code or a jsfiddle, I suspect your code would land you into an infinite loop since updateRow() would cause another change event and so on. There is no need to call updateRow if you update rowData in updateList
ui.updateList[i].rowData
Alternative ways:
1) use beforeValidate event to make change in newRow and oldRow in ui.updateList
ui.updateList[i].newRow
ui.updateList[i].oldRow
2) use copy method of Range object
https://paramquery.com/pro/api#method-Range
3) use of formulas.