am new to datatables. as i was doing practise today, i followed all instruction but still it didnt w

am new to datatables. as i was doing practise today, i followed all instruction but still it didnt w

Reuben15Reuben15 Posts: 1Questions: 1Answers: 0

am new to datatables. as i was doing practise today, i followed all instruction but still it didnt work. see the code below. please help correct it.

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<link rel="stylesheet" type="text/css" href="DataTables/media/css/jquery.dataTables.min.css" />
<link rel="stylesheet" type="text/css" href="DataTables/media/css/dataTables.bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css"/>




$(document).ready(function() { $('#my_table').DataTable(); });

</head>

<body>

<

div>

Name Position Office Age Start date Salary
Name Position Office Age Start date Salary
Tiger Nixon System Architect Edinburgh 61 2011/04/25 $320,800
Garrett Winters Accountant Tokyo 63 2011/07/25 $170,750
Ashton Cox Junior Technical Author San Francisco 66 2009/01/12 $86,000
Cedric Kelly Senior Javascript Developer Edinburgh 22 2012/03/29 $433,060

Answers

  • mattkylemattkyle Posts: 7Questions: 2Answers: 0
    edited December 2015

    Could you lease post the full HTML (in tags). You need to follow the structure below.

    You also need the following javascript outlined in your header:

    //code.jquery.com/jquery-1.11.3.min.js
    https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js
    
    <table id="my_table" class="display" cellspacing="0" width="100%">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Position</th>
                    <th>Office</th>
                    <th>Age</th>
                    <th>Start date</th>
                    <th>Salary</th>
                </tr>
            </thead>
            <tfoot>
                <tr>
                    <th>Name</th>
                    <th>Position</th>
                    <th>Office</th>
                    <th>Age</th>
                    <th>Start date</th>
                    <th>Salary</th>
                </tr>
            </tfoot>
            <tbody>
                <tr>
                    <td>Tiger Nixon</td>
                    <td>System Architect</td>
                    <td>Edinburgh</td>
                    <td>61</td>
                    <td>2011/04/25</td>
                    <td>$320,800</td>
                </tr>
                <tr>
                    <td>Garrett Winters</td>
                    <td>Accountant</td>
                    <td>Tokyo</td>
                    <td>63</td>
                    <td>2011/07/25</td>
                    <td>$170,750</td>
                </tr>
         </tbody>
    </table>
    
This discussion has been closed.