class="do-not-sort-this" can't find it in the docs (not bSort case)

class="do-not-sort-this" can't find it in the docs (not bSort case)

spamyboyspamyboy Posts: 3Questions: 0Answers: 0
edited July 2010 in General
I need to indicate in a header to do-not-sort-this (adding a class of the name, most likely). However, I didn't manage to find this mentioned in the docs. Does this exists? bSort is not friendly in my case because I have dynamic tables.

Please advice for a solution.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    What you are looking for is the new aoColumnDefs feature in the 1.7 betas :-). You can define a column definition (with bSort:false) and target it at the columns with the class you are looking for:

    [code]
    $(document).ready(function() {
    $('#example').dataTable( {
    "aoColumnDefs": [
    { "bSort": false, "aTargets": [ "do-not-sort-this" ] }
    ]
    } );
    } );
    [/code]
    This will become the recommended way of interacting with columns, rather than aoColumns - which as you have found can be a bit limiting. However aoColumns will remain and still be usable.

    For all new features in 1.7: http://datatables.net/new/1.7

    Allan
  • spamyboyspamyboy Posts: 3Questions: 0Answers: 0
    Well, I did it like you said:

    [code]

    var oTable;

    $(document).ready(function() {
    oTable = $('.pagination').dataTable( {
    'bLengthChange': false,
    'sPaginationType': 'full_numbers',
    'bSortClasses': false,
    'aoColumnDefs': [{ "bSort": false, "aTargets": [ 'do-not-sort' ] }]
    } );

    $("tfoot input").keyup( function () {
    oTable.fnFilter( this.value, $(this).parent().index() );
    });
    } );

    [/code]

    And I have [...], though it does not seem to work. I am using 1.7 beta 4.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Oops sorry - it's bSortable ( http://datatables.net/usage/columns#bSortable ), not bSort (which is a top level feature parameter).

    Allan
  • spamyboyspamyboy Posts: 3Questions: 0Answers: 0
    Worked like a charm. Thank you.
This discussion has been closed.