开发者

Add Criteria to jqgrid delete confirmation popup box

In jqGrid, when you attempt to delete a row or set of rows, a confirmation box pops up saying

Delete selected record(s)?

I would like to add checkboxs and poss开发者_StackOverflow社区ibly other html controls to the confirmation box, that would add conditions to this delete operation.

An example of a condition would be flags to decide of to delete related items.

for example, the confirmation popup would have to following information:

    You are about to delete (x) items

    <input type="checkbox" name="condition1" value="condition1">Condition 1
    <input type="checkbox" name="condition2" value="condition2">Condition 2 

Of course I would also like to post these inputs back to the server along with the defaults posted by jqgrid delete.

So my questions are

  1. how to add HTML form elements to the JQgrid delete confirmation Pop up
  2. how to post the form's variables to the server


If I understand correct your requirements you should not modify existing Delete dialog. Instead of that you can just add your custom buttom to the navigator toolbar with respect of navButtonAdd. If you would use buttonicon:"ui-icon-trash" the custom button will look like the original Delete button.

Then you can open any Dialog as the reaction on the onClickButton. If the user click submit button in your dialog you can post the choosed ids manually using jQuery.ajax. If you examine the code and the demo from the old answer you could find many code fragmants which you could use.


I would take the following steps:

  • Find the delete function that is triggered when deleting rows
  • Include the required HTML into the confirmation box. The selected rows will be included in the delete function as an object of some kind.
  • Include your AJAX call and set the callbacks to correctly modify and refresh the jqGrid upon success/failure
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜