ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: stoodin on May 14, 2014, 07:12:19 pm
-
Hi Paramvir,
I just wonder if you have any examples of how to delete a row with right mouse click.
I have a problem to show a "delete row" menu on the right click.
Here is what I do now:
$grid.on( "pqgridrowrightclick", function( event, ui ) {
var rowIndx = ui.rowIndx;
$grid.pqGrid("addClass", { rowIndx: rowIndx, cls: 'pq-row-delete' });
// Dialog doesn't work well.
// var ans = window.confirm("Are you sure to delete row No " + (rowIndx+1) + "?");
// if (ans) {
$grid.pqGrid("deleteRow", { rowIndx: rowIndx, effect: true, complete: function () {
$grid.pqGrid("removeClass", { rowIndx: rowIndx, cls: 'pq-row-delete' });
}
});
// }
// else {
// $grid.pqGrid("removeClass", { rowIndx: rowIndx, cls: 'pq-row-delete' });
// }
});
Thanks a lot,
-
I'm afraid to say there is no live example for right click delete row.
What exactly are you trying to do? you mentioned dialog doesn't work well, are you facing any problem with it.
-
Thanks a lot,
I've managed it after adding a contextMenu plugin
$.contextMenu({
selector: '.pq-row-delete',
callback: function(key, options) {
if (key == "Delete Row") {
var ans = window.confirm("Are you sure to delete row No " + (g_dltRowIndx+1) + "?");
if (ans) {
$grid.pqGrid("deleteRow", { rowIndx: g_dltRowIndx, effect: true, complete: function () {
$grid.pqGrid("removeClass", { rowIndx: g_dltRowIndx, cls: 'pq-row-delete' });
}
});
}
else {
$grid.pqGrid("removeClass", { rowIndx: g_dltRowIndx, cls: 'pq-row-delete' });
}
}
else
$grid.pqGrid("removeClass", { rowIndx: g_dltRowIndx, cls: 'pq-row-delete' });
g_dltRowIndx = -1;
},
items: {
"Delete Row": {name: "Delete", icon: "delete"},
"Cancel": {name: "Cancel", icon: "quit"}
}
});