0

On http://www.elitedeafpoker.com/dev/poker-players.html - I cant get the sortable table to work. I need some help to make it work.

HTML

<table id="myTable" class="tableData">
    <thead>
        <tr>
            <th>Rank</th>
            <th width="250">Name</th>
            <th>Earnings</th>
            <th>Points</th>
            <th>Total Earnings</th>
        </tr>
    </thead>
    <tbody></tbody>
 </table>

JAVASCRIPT -

$(document).ready(function() { 
    $("#myTable").tableData(); 
} 
);

jQUERY plugin - http://www.elitedeafpoker.com/dev/js/jquery.tablesorter.min.js

All of the codes were referred by http://tablesorter.com/docs/ please let me know what I've missed.

4

3 回答 3

1

Notice the error in your browser's console: Uncaught TypeError: Object [object Object] has no method 'tableData'

The correct method that the Tablesorter plugin provides is tablesorter, so you want to use:

$("#myTable").tablesorter();

The website link you referenced specifically has this code:

$(document).ready(function() 
    { 
        $("#myTable").tablesorter(); 
    } 
);

If you're using AJAX to load the rows, you need to call:

$("#myTable").trigger("update");

after they are appended.

于 2013-04-18T21:45:29.957 回答
0

If I could make a suggestion about libraries, I've used tablesorter before, and eventually switched over to DataTables. Excellent library, with sorting, filtering, etc. built in, and had an awesome, responsive developer, great documentation, and a great community for support.

于 2013-04-18T22:11:38.913 回答
0

I would try and use DataTables. The library you are trying to use was last updated in 03-2008 that's almost 5 years ago. In the example The jQuery Version is 1.2. The present version of stable jQuery is 1.9+. There are many changes that are not backward compatible in the intermediate versions.


If you really want just table sorting. If you insist on using just javascript then you could look at this http://www.kryogenix.org/code/browser/sorttable/sorttable.js . The last time I tried it worked fine.

于 2013-04-18T22:31:23.233 回答