ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: EPM Solutions on October 13, 2017, 02:54:59 pm
-
Hello Support Team,
I try to delete row under grouping but not able to delete.
Here is example my code:
var myGrid = this;
$cell.find("button").button({
icons: {
primary: 'ui-icon-scissors'
}
})
.bind("click", function() {
var ans = window.confirm("Are you sure to delete?");
if (ans) {
myGrid.deleteRow({
rowIndx: rowIndx
});
}
});
and also try with below code:
$cell.find("button").button({
icons: {
primary: 'ui-icon-scissors'
}
})
.bind("click", function() {
var group = $("#grid").pqGrid("Group");
group.removeGroup('Project_tx');
var ans = window.confirm("Are you sure to delete?");
if (ans) {
myGrid.deleteRow({
rowIndx: rowIndx
});
group.addGroup('myGrpColumn');
} else {
group.addGroup('myGrpColumn');
}
});
In the second code the row id is not current because after remove the grouping the row index is changed.
Please find below screen shot for giving you some idea about my requirement.
-
You can get new value of rowIndx from ui.rowData as rowData doesn't change with grouping on/off.
render: function (ui) {
return "<button type='button' class='delete_btn'>Delete</button>";
},
postRender: function (ui) {
var grid = this,
$cell = grid.getCell(ui);
$cell.find(".delete_btn")
.button({ icons: { primary: 'ui-icon-scissors'} })
.bind("click", function (evt) {
//turn off grouping.
grid.Group().option({on: false});
grid.deleteRow({
//get fresh rowIndx from rowData
rowIndx: grid.getRowIndx({rowData: ui.rowData }).rowIndx
});
//turn on grouping.
grid.Group().option({on: true});
});
}
please note that this approach is not compatible with batch editing.
The only way I can see it work is to use Row editing: add / edit/ delete one row at a time, save the changes and purge the transaction history.
https://paramquery.com/pro/demos/editing
-
Hello Support Team,
Thanks for your response, i tried with given solution and it working fine.
:) :D :D :D :D :) :) :)