jQuery 对话框 - 带有数据表的对话框未居中放置
我有一个 jquery 模式对话框,我在其中加载 jquery 数据表。我无法使对话框显示在中心(目前它保持在右侧) 知道可能的原因是什么吗?解决方案? 我尝试了位置:中心,但它不起作用。 我的脚本是这样的:
// Dialog for food details
var $detaildialog;
$detaildialog = $('#detaildialog').dialog({
autoOpen: false,
title: 'Food Details',
modal: true,
position: 'center',
width: 'auto',
height: 'auto'
});
//Call Details action to display the food details
var url = '/Food/Details?cid=' + id;
//Use .load callback function to ensure details is loaded before dialog open
$detaildialog.load(url, function () {
$('#loading').hide();
$detaildialog.dialog('open');
});
并且仅在此处显示我的数据表 html 的一部分:
<div id="tableplaceholder">
<table id="stocktable" class="pretty">
<thead>
<tr>
<th>
Name
</th>
<th>
Amount
和 css:
#tableplaceholder
{
width: 100%;
}
此处需要帮助...感谢任何反馈......
I got a jquery modal dialog which i load a jquery datatable inside. I cant make the dialog to display at the center (currently it keeps to the right)
Any idea what will be the possible cause & solution?
I tried position: center, but it dint work.
My script is like this:
// Dialog for food details
var $detaildialog;
$detaildialog = $('#detaildialog').dialog({
autoOpen: false,
title: 'Food Details',
modal: true,
position: 'center',
width: 'auto',
height: 'auto'
});
//Call Details action to display the food details
var url = '/Food/Details?cid=' + id;
//Use .load callback function to ensure details is loaded before dialog open
$detaildialog.load(url, function () {
$('#loading').hide();
$detaildialog.dialog('open');
});
And just showing part of my datatable html here:
<div id="tableplaceholder">
<table id="stocktable" class="pretty">
<thead>
<tr>
<th>
Name
</th>
<th>
Amount
And css:
#tableplaceholder
{
width: 100%;
}
Need help here... Appreciate any feedback......
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然我不知道为什么,但是在固定对话框 div 宽度后,对话框居中。如果有人遇到同样的情况,请发布在这里。谢谢!
although I not sure why, but after I fixed the dialog div width, the dialog is centered. Just post it here in case anyone having the same situation. Thanks!