Hi,
Is it possible to modify the delete dialog to show the Ids of the selected records within the Delete Dialog message box?
And/or to highlight that more than one record has been selected and marked for deletion.
The current dialog shows for either one row selected or 2.
Thanks – Greg
On your page, you can set following:
<script>
$.jgrid.del.msg = "Custom Delete Message?";
</script>
Second option is not available now.
Is there a way in Javascript to query the grid to see which rows are selected?
This would accomplish my task when included with the above script no?
Greg
Return array of id's of the selected rows when multiselect options is true. Empty array if not selection
var selr = jQuery('#list1').jqGrid('getGridParam','selarrrow');
where list1 is grid id.
You can use selr.count to get # of selected row.
More from http://phpgrid.org/faqs ->Javascript API
Hi,
Here is what I wrote…
function getCellCount() {
var CellCount = 0;
var selr = jQuery('#list1').jqGrid('getGridParam','selarrrow');
//alert(selr.count);
alert("here");
return CellCount;
}
$.jgrid.del.msg = "Are you sure you want to delete " + getCellCount() + " row(s)?";
But it seems to only evaluate on load of the grid itself? The selr variable always returns undefined and/or throws an error when the delete message is called.
Thanks – Greg
I have not tested it but you can try putting:
$.jgrid.del.msg = "Are you sure you want to delete " + getCellCount() + " row(s)?";
Inside afterShowForm event:
$opt["delete_options"]["afterShowForm"] = 'function () {…}';
$g->set_options($opt);
Here is another way of doing custom message from javascript:
$opts[“delete_options”] = array(‘width’=>’600’, ‘msg’=>'<div id=”custom_msg”>custom message here</div>’, ‘bSubmit’ => ‘Delete’);
$opts[“delete_options”][“afterShowForm”] = ‘function(form) {
// You could do other stuff, just and example..
var selr = jQuery(“#AttributeTypesGrid”).jqGrid(“getGridParam”,”selrow”);
jQuery(“#custom_msg”).html( “Are you sure you want to delete the row#” + selr + “?<br>”);