ParamQuery grid support forum
General Category => Help for ParamQuery Grid (free version) => Topic started by: shoushouleb on August 14, 2018, 11:26:54 am
-
Hello,
How can I add a new empty row, to the nested grid, where the new row is added to the child grid of the current selected row.
Thanks,
-
reference to child grid can be obtained from rowData.pq_detail.child where rowData is row data of selected row of parent grid.
Once you have reference to child grid, you can use any API method of pqgrid on it.
-
Thank you for your reply, I need to append a new row upon clicking the "New" button in the toolbar.Please check the attached image.
-
This is the solution:
toolbar: {
items: [
{
type: 'button', icon: 'ui-icon-plus', label: 'New', listener:
{
"click": function (evt, ui) {
debugger;
var $gridDet = $(this).closest('.pq-grid');
//append empty row at the end.
var rowData = { ID: "2", 'Name':'Has'}; //empty row
var rowIndx = $gridDet.pqGrid("addRow", { rowData: rowData, checkEditable: true });
$gridDet.pqGrid("goToPage", { rowIndx: rowIndx });
$gridDet.pqGrid("editFirstCellInRow", { rowIndx: rowIndx });
}
}
}
]