2

I am using Bootstrap and DataTables/Editor.

In Google Chrome the table renders ok within a normal Bootstrap container and has Bootstrap styling, but in Internet Explorer the table renders as full width and doesn't have Bootstrap styling.

I have been using Bootstrap for some time and I have never seen these inconsistencies in browsers when using it so there must be something in my code that is breaking Internet Explorer - but I don't know what.

Here is the code:

<!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>
  • What version of IE is giving you the issue? – Izzy Apr 09 '15 at 08:07
  • Do you see any console errors? – DavidG Apr 09 '15 at 08:09
  • @Izzy I am on Internet Explorer 11 and I have the problem but there are earlier versions that also have the problem. –  Apr 09 '15 at 08:25
  • @DavidG **Console** shows 'The attached page targets document mode 7. Some console APIs and features may not be available. That's about all. The other tabs look normal. –  Apr 09 '15 at 08:31
  • 1
    Is IE running in compatibility mode? – DavidG Apr 09 '15 at 08:34
  • Possible duplicate of [IE11 Document mode defaults to IE7. How to reset?](http://stackoverflow.com/questions/27272454/ie11-document-mode-defaults-to-ie7-how-to-reset) – Teepeemm May 02 '16 at 19:23

1 Answers1

0

I think that the problem is not link to bootstrap itself but to datatable which is not supported by some version of IE.

You can style use class = "table table-stripped" from bootstrap to stylish your table and add some javascript/JQuery to do the actions you need.

Weedoze
  • 13,683
  • 1
  • 33
  • 63