jQuery dataTable doesn't show sort icon

PsCraft picture PsCraft · Nov 27, 2011 · Viewed 70.5k times · Source

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

Answer

John picture John · Oct 25, 2014

I had this problem, I found because I had copied the CDN script to my local machine it wasn't referencing the images correctly anymore as @Matt2012 pointed out. So my solution was to updated the CSS file to look for those images where I want to put them, after I saved them also.

See this part:

table.dataTable thead .sorting { background: url('/Content/images/sort_both.png') no-repeat center right; }
table.dataTable thead .sorting_asc { background: url('/Content/images/sort_asc.png') no-repeat center right; }
table.dataTable thead .sorting_desc { background: url('/Content/images/sort_desc.png') no-repeat center right; }

table.dataTable thead .sorting_asc_disabled { background: url('/Content/images/sort_asc_disabled.png') no-repeat center right; }
table.dataTable thead .sorting_desc_disabled { background: url('/Content/images/sort_desc_disabled.png') no-repeat center right; }