admin管理员组

文章数量:1405549

Please guide as to what I'm doing wrong!

Javascript:

<script src=".11.1.min.js"></script>
<script src=".10.4/js/jquery.dataTables.min.js"></script>
<script>
    $(function() {

        $('#example').dataTable({
            "scrollY" : 800,
            "scrollX" : true,
            "paging" : false,
            "ordering" : true,
            //"order": [[ 3, "desc" ]],
            "info" : true,
            "columns": [{
                "orderDataType": "dom-text-numeric",
                "orderDataType": "dom-text-numeric",
                "orderDataType": "dom-text-numeric",
                "orderDataType": "dom-text-numeric",
                "orderDataType": "dom-text-numeric",
                "orderDataType": "dom-text-numeric"
            }]
        });
    });
</script>

HTML:

<table id="example" style="border-collapse:collapse;" border="1">
        <thead>         
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>

        <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>

Datatables Table Debugger result:

JSFiddle:

/

Please guide as to what I'm doing wrong!

Javascript:

<script src="https://code.jquery./jquery-1.11.1.min.js"></script>
<script src="https://cdn.datatables/1.10.4/js/jquery.dataTables.min.js"></script>
<script>
    $(function() {

        $('#example').dataTable({
            "scrollY" : 800,
            "scrollX" : true,
            "paging" : false,
            "ordering" : true,
            //"order": [[ 3, "desc" ]],
            "info" : true,
            "columns": [{
                "orderDataType": "dom-text-numeric",
                "orderDataType": "dom-text-numeric",
                "orderDataType": "dom-text-numeric",
                "orderDataType": "dom-text-numeric",
                "orderDataType": "dom-text-numeric",
                "orderDataType": "dom-text-numeric"
            }]
        });
    });
</script>

HTML:

<table id="example" style="border-collapse:collapse;" border="1">
        <thead>         
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>

        <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>

Datatables Table Debugger result:

http://debug.datatables/ogimac

JSFiddle:

http://jsfiddle/sajjansarkar/pqzkx1oj/1/

Share Improve this question asked Jan 19, 2015 at 17:21 Sajjan SarkarSajjan Sarkar 4,2086 gold badges41 silver badges54 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 1
<script>
    $(function() {

        $('#example').dataTable({
            "scrollY" : 800,
            "scrollX" : true,
            "paging" : false,
            "ordering" : true,
            //"order": [[ 3, "desc" ]],
            "info" : true,
            "columns": [
                {"orderDataType": "dom-text-numeric"},
                {"orderDataType": "dom-text-numeric"},
                {"orderDataType": "dom-text-numeric"},
                {"orderDataType": "dom-text-numeric"},
                {"orderDataType": "dom-text-numeric"},
                {"orderDataType": "dom-text-numeric"}
            ]
        });
    });
</script>

each orderDataType needs to be in its own object. https://datatables/reference/option/columns.orderDataType

本文标签: javascriptCannot read property 39mData39 of undefined for a simple tableStack Overflow