jQuery 模式对话框和 jqGrid
如何将 Jquery 模态确认与 jqGrid 一起使用?假设当我提交我的条目时,它将弹出一个模式对话框并显示名称以及发送到服务器的消息。
我的方法是
$("#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');
}
}
});
});
我的 html:
<div id="dialog-confirm" title="Confirm">
<p><span class="ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Are you sure want to cancel(or send this names)#names?</p>
</div>
在该对话框中我也需要发送这些名称...但是这种方法不会给我我选择将其发送到服务器的网格中的名称。
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 :
<div id="dialog-confirm" title="Confirm">
<p><span class="ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Are you sure want to cancel(or send this names)#names?</p>
</div>
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下代码可以满足您的需要
。具体原因的解决方案取决于您对服务器端的要求。您可以在此处尝试此操作(无需ajax请求) http://www.ok- soft-gmbh.com/jqGrid/DataToMultiSelect2.htm。选择一些项目并单击“获取选择”按钮。
The following code could do what you need
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.