开发者

jQuery Dialog - Dialog with DataTables is not positioned centered

开发者 https://www.devze.com 2023-04-13 03:15 出处:网络
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)

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').d开发者_如何学编程ialog({
        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......


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号