jQuery modal dialog and jqGrid

匿名 (未验证) 提交于 2019-12-03 01:48:02

问题:

How can I use the Jquery modal confirmation with jqGrid? Say when I will submit my entries it will pop up a modal dialog and display the names with the message for sending to server..

My approach

$("#dialog-confirm").dialog({             autoOpen:false,             resizable:false,             height:180,             modal:true,             buttons:{                  'Confirm': function(){                             var ids =jQuery("#list10").jqGrid('getGridParam','selarrrow');                                 $.ajax({                                   type: "POST",                                   url: "url&names="+ids,                                   data: JSON.stringify(ids),                                    dataType: "json"                             });                                 },                             'cancel': function(){                                     $(this).dialog('close');                                     }         }         });         }); 

my html :

Are you sure want to cancel(or send this names)#names?

In that dialog box I need to send those names as well... but this approach will not give me the names from my grid which I selected to send it to server.

回答1:

The following code could do what you need

$("#wics").click( function(){     var grid = jQuery("#list10");     var ids = grid.jqGrid('getGridParam','selarrrow');     if (ids.length>0) {         var names = [];         for (var i=0, il=ids.length; i 

The exact solution of cause will depends on your requirement on the server side. You can try this (without ajax request) here http://www.ok-soft-gmbh.com/jqGrid/DataToMultiSelect2.htm. Select some items and click "Get Selected" button. 



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!