DataTables

https://datatables.net/download/

这个页面,根据需要选择一个styling Framework,比如bootstrap4

step3选择Download这个tab,然后勾选concatenate,

最后下载的css和js文件开头会有一段类似

/*
 * This combined file was created by the DataTables downloader builder:
 *   https://datatables.net/download
 *
 * To rebuild or modify this file with the latest versions of the included
 * software please visit:
 *   https://datatables.net/download/#bs4/pdfmake-0.2.7/dt-1.13.6/b-2.4.2/b-html5-2.4.2/b-print-2.4.2
 *
 * Included libraries:
 *   pdfmake 0.2.7, DataTables 1.13.6, Buttons 2.4.2, HTML5 export 2.4.2, Print view 2.4.2
 */

 

https://github.com/DataTables/DataTables

DataTables is a table enhancing plug-in for the jQuery Javascript library, adding sorting, paging and filtering abilities to plain HTML tables with minimal effort. The stated goal of DataTables is:

To enhance the accessibility of data in HTML tables.

To meet this goal, DataTables is developed with two distinct groups of users in mind:

  • You the developers using DataTables. For developers DataTables provides a wide array of options for how data should be obtained, displayed and acted upon, along with an extensive API for accessing and manipulating the table.

  • End users. For those using the interface DataTables presents, actions to get the most from the information contained in tables, such as sorting and filtering, along with paging and scrolling of the data in table, are easy to use, intuitive and fast.

 

问题1 Cannot read property 'aDataSort' of undefined

https://stackoverflow.com/questions/28454203/jquery-datatables-cannot-read-property-adatasort-of-undefined

It's important that your THEAD not be empty in table.As dataTable requires you to specify the number of columns of the expected data . As per your data it should be

<table id="datatable">
    <thead>
        <tr>
            <th>Subscriber ID</th>
            <th>Install Location</th>
            <th>Subscriber Name</th>
            <th>some data</th>
        </tr>
    </thead>
</table>

 

问题2 隐藏掉search搜索框以及show entries

bLengthChange: false,
searching: false,

 

问题3  Cannot read property 'length' of undefined

https://datatables.net/manual/ajax

和ajax的返回值有关系

posted @ 2018-07-03 11:28  ChuckLu  阅读(285)  评论(0编辑  收藏  举报