Can we exclude sorting option from some of the columns

Can we exclude sorting option from some of the columns

vikash_chaurasia1vikash_chaurasia1 Posts: 13Questions: 0Answers: 0
edited August 2010 in General
Hi,

Can we exclude sorting option from some of the columns?

My requirement is: I have some column headers like Action or checkall (checkbox) which should not be sortable. Can somebody help me, how can I do this?

Thanks

Replies

  • cdaiglecdaigle Posts: 57Questions: 0Answers: 0
    What your looking for is "bSortable" in the column definitions.
    Look under bSort here: http://datatables.net/usage/features (it mentions bSortable)
    Here is an example:

    [code]
    oTable.dataTables({
    ...
    "aoColumns":[{"sTitle":"Action", "bSortable":false},{"sTitle":"checkall", "bSortable":false},{"sTitle":"someColumn"}],
    ...
    });
    [/code]
    Here, Action and checkall will not be sortable, but someColumn will be.

    Hope this helps.
  • vikash_chaurasia1vikash_chaurasia1 Posts: 13Questions: 0Answers: 0
    Thanks a lot. But I used the following and it got resolved:

    "aoColumns": [ { "bSortable": false },
    { "bSortable": true },
    { "bSortable": true },
    { "bSortable": true },
    { "bSortable": true },
    { "bSortable": true },
    { "bSortable": true },
    { "bSortable": false },
    { "bSortable": false }
    ]
  • cdaiglecdaigle Posts: 57Questions: 0Answers: 0
    edited August 2010
    Yeah, it depends on how you define your columns. (Instead of defining them in the DOM, via AJAX or any other way, I simply defined mine in the aoColumns array).
    Here are some more options you can use for your columns: http://datatables.net/usage/columns .(It also has more stuff on bSortable)

    Glad you got it working.
This discussion has been closed.