Delete Message with Selected Records

QuestionsDelete Message with Selected Records
Greg asked 8 years ago

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

6 Answers
Abu Ghufran answered 8 years ago

On your page, you can set following:

<script>
$.jgrid.del.msg = "Custom Delete Message?";
</script>

Second option is not available now.

Greg answered 8 years ago

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

Abu Ghufran answered 8 years ago

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

Greg answered 8 years ago

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

Abu Ghufran answered 8 years ago

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);

jorge answered 4 years ago

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>”);

Your Answer

16 + 9 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?