jQuery dataTable doesn't show sort icon

2019-01-19 10:02发布

I am trying to use a jQuery dataTable plugin. The problem is that the sort icon (this arrow which point in which direction data is actual sorted) is not displayed.

My code looks as follows:

$('#example').dataTable(
{
    "bPaginate": false,
    "bFilter": false,
    "oLanguage": { "sInfo": ""}        
}
);

and Html:

<table class="surfClass" cellspacing="1" id="example">

<thead>
<tr>
    <th width="120px">Name</th>
    <th width="120px">The hourly rate (points)</th>
    <th>Levels of referrals</th>
    <th>bonuses</th>
    <th width="70px">Payout minimum</th>
</tr>
</thead>

8条回答
一夜七次
2楼-- · 2019-01-19 10:35

I had the problem too. Just use their own configurator to setup all the options you want form here https://datatables.net/download/ they will generate exactly the .js and .css files you need. You then can either download or use their own hosted CDN for both files

查看更多
祖国的老花朵
3楼-- · 2019-01-19 10:41

I fixed the problem by wrapping the table header text in a <div>:

<th><div>Date</div></th>
查看更多
登录 后发表回答