适用于文档中所有表的通用jQuery排序解决方案

时间:2013-02-15 16:09:11

标签: jquery

为我的表实现通用jQuery排序解决方案的最佳方法是什么,这样当用户单击thead元素时,它将按字母顺序或数字顺序对列进行排序。这是我的代码:http://jsfiddle.net/uJmJ7/

<table class="ui-widget" style="border-collapse: collapse;">
    <thead class="ui-widget-header">
        <tr>
            <th>Module Code</th>
            <th>Module Name</th>
            <th>Module Grade</th>
        </tr>
    </thead>
    <tbody class="ui-widget-content">
        <tr>
            <tr class="moduleList">
                <td class="moduleList_id">SB005</td>
                <td class="moduleList_name">Accounting</td>
                <td class="moduleList_grade">79</td>
            </tr>
            <tr class="moduleList">
                <td class="moduleList_id">SA572</td>
                <td class="moduleList_name">Statistics</td>
                <td class="moduleList_grade">45</td>
            </tr>
            <tr class="moduleList">
                <td class="moduleList_id">SA570</td>
                <td class="moduleList_name">Methods for Business</td>
                <td class="moduleList_grade">56</td>
            </tr>
            <tr class="moduleList">
                <td class="moduleList_id">SA526</td>
                <td class="moduleList_name">Finance</td>
                <td class="moduleList_grade">89</td>
            </tr>
            <tr class="moduleList">
                <td class="moduleList_id">SA512</td>
                <td class="moduleList_name">Leisure</td>
                <td class="moduleList_grade">66</td>
            </tr>
            <tr class="moduleList">
                <td class="moduleList_id">SA510</td>
                <td class="moduleList_name">Environment</td>
                <td class="moduleList_grade">30</td>
            </tr>
        </tr>
    </tbody>
</table>

1 个答案:

答案 0 :(得分:1)

您可能想要查看插件或具有此功能的KendoUI等内容......

KendoUI

DataTables.net