Wrong table layout on first show

Wrong table layout on first show

ThalliusThallius Posts: 31Questions: 4Answers: 0


I like to embed a datatable into a div which is absolute postioned. the structure of this div and the code for the datatable is (I am sorry its in PHP :-) :

        echo '<div id="selectTableEditDiv" class="editDiv" >';
        echo '<table class="editTitleTable" cellspacing="0" cellpadding="0"><tr><td class="editTitleCell">'.$title.'</td></tr></table>';
        echo '<table class="editTable"><tr><td>';

        echo '<div id="selectTableDiv" style="height: 320px">';
        echo '<table id="selectTable" cellpadding="0" cellspacing="0" border="0" class="display" id="selectTable"><thead><tr>';
        foreach($dataArray as $data)
                echo '<th style="border-top-left-radius: 6px;">'.$data.'</th>';
                echo '<th style="border-top-right-radius: 6px;">'.$data.'</th>';
                echo '<th >'.$data.'</th>';
        echo '</tr></thead><tbody><tr><td colspan="'.count($dataArray).'" class="dataTables_empty">'.$loadDataText.'</td></tr></tbody></table>';
        echo '</div>';
        echo '</td></tr>';
        echo '<tr>
                <td colspan="1">
                    <table width="100%" cellpadding="0" cellspacing="0">
                            <td class="editButtonCell">
                                <input type="button" onclick="saveSystem()" class="editButton" value="'.$okText.'" />
                            <td class="editButtonCell">
                                <input type="button" onclick="cancelEditSystem()" class="editButton" value="'.$cancelText.'" />
        echo '</table>';
        echo '</div>';

        echo '<script type="text/javascript" charset="utf-8">';
        echo '  var selectTable = null;
                    var content= $("#selectTableDiv");
                        "sScrollY": content.height()-74-26,
                        "aLengthMenu": [[10, 25, 50, 100 , -1], [10, 25, 50, 100, "'.$allText.'"]],
                        "bProcessing": true,
                        "bServerSide": true,
                        "sAjaxSource": "./datasource/ds_sites.php",
                        "bStateSave": true
        echo 'var selectTableEditDiv= $("#selectTableEditDiv"); selectTableEditDiv.hide();  selectTableEditDiv.css("visibility","visible"); ';
        echo '</script>';

As you see the div is hidden first and will be faded in on a button click. When the div is visible, it looks like this


When I click on any header to change the sort. the layout refreshes and everything looks fine. So I need a hint what to do to get the layout correct on startup.

Thanks in advance


This question has an accepted answers - jump to answer


This discussion has been closed.