如何在jqGrid中使用Jquery模态确认框?例如,当我提交我的条目时,它会弹出一个模态对话框,并显示名称和要发送到服务器的消息。
我的做法:
$("#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>
在那个对话框中,我需要发送这些名称...但是这种方法无法从我选择要发送到服务器的网格中获取名称。
$.jgrid.info_dialog("某些可能是<i>HTML</i>文本的标题", "一些其他<span style='color:red'>HTML</span>文本", true);
。您可以使用额外的参数来获取其他选项:请参见源代码。 - Oleg.info_dialog
没有像select a row
弹窗一样在窗口中心显示,有什么方法可以解决吗? - CJ Ramki$.jgrid.info_dialog
的选项(第四个参数):top
,left
,width
,height
和其他来指定信息对话框的位置和大小。或者,您可以使用jQuery UI Position在创建对话框后直接更改对话框的位置。请参见此处。 - Oleg