0

EDIT Nevermind... I really was missing the obvious... 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?

1
  • 4
    If you answered your own question, you should post the answer below so that others can benefit from your experience. Commented Mar 7, 2010 at 17:26

3 Answers 3

3

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] },
      ]
});
Sign up to request clarification or add additional context in comments.

Comments

0

use "bSortable": false

Comments

0
$('#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}
            ]
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.