fnSortListener and sorting_asc / sorting_desc classes

fnSortListener and sorting_asc / sorting_desc classes

diddid Posts: 2Questions: 0Answers: 0
edited October 2011 in General
Hello,

I use fnSortListener to add sorting on a hidden column, what would be the right way to have the sorting classes synced for that element? The callback would not work as the sorting could be modified by clicking on another column too.

Thanks,
Did

Replies

  • diddid Posts: 2Questions: 0Answers: 0
    sounds like fnStateSaveCallback would be the best option, if bStateSave is enabled

    sample code working for me :

    [code]
    "fnStateSaveCallback": function ( oSettings, sValue ) {
    var order = '';
    for (var i in oSettings.aaSorting) {
    if (oSettings.aaSorting[i][0] == 5) {
    order = '_'+oSettings.aaSorting[i][1];
    break;
    }
    }
    $('#myId').removeClass().addClass('sorting'+order);
    return sValue;
    }
    [/code]

    it adds class 'sorting_asc', 'sorting_desc' or 'sorting' to an element with id 'myId' based on the sorting state of column 5.
This discussion has been closed.