A basic search datatable not working

A basic search datatable not working

Saab93Saab93 Posts: 2Questions: 1Answers: 0

Now i have spent a weekend to get this working, but not. It's just a basic thing! No search box, nothing, just the table is showing. My code is:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test </title>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.3/css/jquery.dataTables.min.css"></link>
<script type="text/javascript" language="javascript" src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.11.3/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/select/1.3.3/js/dataTables.select.min.js"></script></script>
<script>
        $(document).ready(function() {
    $('#TableId').DataTable( {
        select: true
    } );
} );
</script>    
</head>
<body>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table border="1" class="display" id="TableId" style="width:100%">
    <thead>
            <tr>
                <th>Nuvarandemålgrupp</th>
                <th>Nuvarandemåltyp</th>
                <th>Nytt Prefix</th>
                <th>Målgrupps nummer</th>
                <th>Målgruppsnamn</th>
                <th>Måltyps nummer</th>
                <th>Måltypsnamn</th>
                <th>Beskrivning</th>
      </tr>
  </thead>
<tbody>
  <tr>
    <td rowspan="3" width="152">10 Tvistem&aring;l</td>
    <td width="203">1052    Diskrimineringsm&aring;l</td>
    <td width="64">T</td>
    <td width="103">100<br></td>
    <td width="126">Tvistem&aring;l<br>
      <br></td>
    <td width="120">11</td>
    <td width="202">Diskriminering</td>
    <td width="449">Tvister enligt    diskrimineringslagen (2008:567) i den m&aring;n det inte r&ouml;r    sig om arbetstvist.</td>
  </tr>
  <tr>
    <td width="203">1038 Klander av skiljedom</td>
    <td width="64">T</td>
    <td width="103">100<br></td>
    <td width="126">Tvistem&aring;l<br>
      <br></td>
    <td width="120">12</td>
    <td width="202">M&aring;l    enligt lagen (1999:116) om skiljef&ouml;rfarande&nbsp;</td>
    <td width="449">M&aring;l enligt lagen (1999:116) om    skiljef&ouml;rfarande.</td>
  </tr>
  <tr>
    <td width="203">1099 &Ouml;vriga tvistem&aring;l</td>
    <td width="64">T</td>
    <td width="103">100<br></td>
    <td width="126">Tvistem&aring;l<br>
      <br></td>
    <td width="120">13</td>
    <td width="202">&Ouml;vriga    tvistem&aring;l</td>
    <td width="449">&Ouml;vrigt som inte passar in i    &ouml;vriga m&aring;ltyper.&nbsp;</td>
  </tr>
  <tr>
    <td width="152">14 Grupptalan</td>
    <td width="203">1410    Enskild grupptalan<br>
      1411 Organisationstalan<br>
      1412 Offentlig grupptalan</td>
    <td width="64">T</td>
    <td width="103">100</td>
    <td width="126">Tvistem&aring;l</td>
    <td width="120">14</td>
    <td width="202">Grupptalan</td>
    <td width="449">M&aring;l    som handl&auml;ggs enligt lagen (2002:599) om gruppr&auml;tteg&aring;ng.</td>
  </tr>
  <tr>
    <td width="152">10 Tvistem&aring;l</td>
    <td width="203">1011    N&auml;ringslivstvist</td>
    <td width="64">&nbsp;</td>
    <td width="103">&nbsp;</td>
    <td width="126">&nbsp;</td>
    <td width="120">&nbsp;</td>
    <td width="202" id="Utgår">KODEN UTGÅR</td>
    <td width="449">R&ouml;r    inte saken utan part. M&aring;l som lades i denna kod kan nu ist&auml;llet sorteras in    under koderna avseende sak ovan. Part framg&aring;r av Vera.&nbsp;</td>
  </tr>
  </tbody>
</table>
</body>
</html>

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    "rowspan" in a tbody is not supported by DataTables.

  • Saab93Saab93 Posts: 2Questions: 1Answers: 0

    Thank u!
    And HOW should i know that??? (not your fault!)
    I deleted the rowspan and tested again. Still the same!

  • kthorngrenkthorngren Posts: 21,322Questions: 26Answers: 4,948

    And HOW should i know that???

    The HTML requirements doc explains what is supported by Datatables.

    I deleted the rowspan and tested again. Still the same!

    The place to start is by looking for errors in the browser's console. It looks like you have defined 8 columns in the thead but some of the rows have only 7 columns. They need to match.

    If you still need help please provide a link to your page or a test case showing the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

Sign In or Register to comment.