开发者

jquery datatables question

EDIT Nevermind... I really was missing the obv开发者_如何学运维ious... duh.

I have a five-column table and am using jquery.datatables.js (http://www.datatables.net/). I'm trying to figure out how to remove sorting for the first and fifth columns so that it's not an option at all...

I've tried the function below, but it's still adding a sort to the columns:

$('#searchlist').dataTable({
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "aoColumns": [
                    null,
                    { "asSorting": [ "asc" ] },
                    { "asSorting": [ "desc", "asc" ] },
                    { "asSorting": [ "desc", "asc" ] },
                    null
                ]
});

Am I missing something?


You could also use aoColumnDefs.

$('#searchlist').dataTable({
     "bJQueryUI": true,
     "sPaginationType": "full_numbers",
     "aoColumnDefs": [
            {"bSortable":false, 'aTargets': [0, 4]},
            {"bSortable":true, "asSorting": [ "asc" ], 'aTargets': [1]},
            {"bSortable":true,"asSorting": [ "desc", "asc" ], 'aTargets': [2, 3] },
      ]
});


use "bSortable": false


$('#searchlist').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": [
                {"bSortable":false},
                {"bSortable":true, "asSorting": [ "asc" ] },
                {"bSortable":true,"asSorting": [ "desc", "asc" ] },
                {"bSortable":true, "asSorting": [ "desc", "asc" ] },
                {"bSortable":false}
            ]
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜