问题
hopefully this is a simple question. In the JQGrid form edit mode, the edit form pops up in the middle of the screen for editing. When I click off of the form, like on the background area, the form closes like I clicked "cancel". I know I can use the "onClose" event to catch this, but I am wondering how I tell the grid not to close unless you click the "cancel" button. I want the editing form to stay there if you click off the form, just close if you click cancel.
I guess I am being a bit lazy, I don't really want to create a modal dialog box that pops up every time it receives the onClose event and asks the user if they really want to stop editing...
Thanks.
回答1:
Looks like you can have jqGrid build the dialog with jqModal, and then you should be able to specify the jqModal option to not close the modal when you click the overlay. See the "modal" option on this page: http://dev.iceburg.net/jquery/jqModal/#how
edit you can specify the "modal" option in your jqGrid form setup when the jqModal library is loaded.
回答2:
You can use both modal and jqModal for this problem. Here is the code snippet, I am using in my app:
//-----------------------add options----------------------//
{
width:800,
closeAfterAdd:true,
reloadAfterSubmit:true,
...
modal:true,
jqModal:true,
....
viewPagerButtons: false,
addCaption: "Add Event",
left:250,
top: 200,
.....
}
I hope this helps...
来源:https://stackoverflow.com/questions/8217920/jqgrid-edit-form-closing-when-click-off-form