Bootstrap とDataTables/Editorを使用しています。
Google Chrome では、テーブルは通常の Bootstrap コンテナ内で正常にレンダリングされ、Bootstrap スタイルが適用されますが、Internet Explorer では、テーブルは全幅でレンダリングされ、Bootstrap スタイルが適用されません。
私はしばらくの間 Bootstrap を使用してきましたが、使用時にブラウザーでこれらの不整合を見たことがないので、コードに Internet Explorer を壊している何かがあるに違いありませんが、何が原因かわかりません。
コードは次のとおりです。
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Editor</title>
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/tabletools/2.2.3/css/dataTables.tableTools.css">
<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/plug-ins/3cfcc339e89/integration/bootstrap/3/dataTables.bootstrap.css">
<link rel="stylesheet" type="text/css" href="//editor.datatables.net/examples/resources/bootstrap/editor.bootstrap.css">
<script type="text/javascript" language="javascript" src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript" language="javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/tabletools/2.2.3/js/dataTables.tableTools.min.js"></script>
<script type="text/javascript" language="javascript" src="js/dataTables.editor.min.js"></script>
<script type="text/javascript" language="javascript" src="//cdn.datatables.net/plug-ins/3cfcc339e89/integration/bootstrap/3/dataTables.bootstrap.js"></script>
<script type="text/javascript" language="javascript" src="//editor.datatables.net/examples/resources/bootstrap/editor.bootstrap.js"></script>
<script type="text/javascript" class="init">
var editor; // use a global for the submit and return data rendering in the examples
$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
ajax: "php/table.php",
table: "#table",
fields: [
{
"label": "column1",
"name": "column1",
"type": "text"
},
{
"label": "column2",
"name": "column2",
"type": "text"
},
{
"label": "column3",
"name": "column3",
"type": "text"
},
{
"label": "column4",
"name": "column4",
"type": "text"
},
{
"label": "column5",
"name": "column5",
"type": "text"
},
{
"label": "column6",
"name": "column6",
"type": "column6"
},
{
"label": "column7",
"name": "column7",
"type": "text"
},
{
"label": "column8",
"name": "column8",
"type": "text"
}
]
} );
var table = $('#table').DataTable( {
lengthChange: false,
ajax: "php/table.php",
columns: [
{
"data": "column1"
},
{
"data": "column2"
},
{
"data": "column3"
},
{
"data": "column4"
},
{
"data": "column5"
},
{
"data": "column6"
},
{
"data": "column7"
},
{
"data": "column8"
},
{
"data": "column9"
}
]
} );
var tableTools = new $.fn.dataTable.TableTools( table, {
sRowSelect: "os",
aButtons: [
{ sExtends: "editor_create", editor: editor },
{ sExtends: "editor_edit", editor: editor },
{ sExtends: "editor_remove", editor: editor }
]
} );
$( tableTools.fnContainer() ).appendTo( '#table_wrapper .col-sm-6:eq(0)' );
} );
</script>
</head>
<body>
<div class="container">
<h1>
Editor
</h1>
<table class="table table-bordered" id="table">
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
<th>Column 4</th>
<th>Column 5</th>
<th>Column 6</th>
<th>Column 7</th>
<th>Column 8</th>
<th>Column 9</th>
</tr>
</thead>
</table>
</div>
</body>
</html>