orderSequence option globally for the table, not for columns

orderSequence option globally for the table, not for columns

brianjaikens-mslbrianjaikens-msl Posts: 6Questions: 2Answers: 0

Hi can we have a "orderSequence" that acts on the whole table please?
I'm having to add this to every column for every table in all our portals. Because the 3 state sort is now the default.

It would have been better to have to enable the 3 state and default to 2 state ('asc', 'desc') as that is the original default behaviour. Out testers keep reporting this as an issue.

Answers

  • allanallan Posts: 61,840Questions: 1Answers: 10,134 Site admin

    Two options:

    1. Apply it using columnDefs with the _all target.
    2. Set the default with DataTable.defaults.column.orderSequence.

    It would have been better to have to enable the 3 state and default to 2 state ('asc', 'desc') as that is the original default behaviour.

    v2 was the time to introduce a few changes to the defaults. deferRender has also been abled by default now. The list of changes is available here, although I see I missed the orderSequence part. Apologies - I'll fix that.

    Allan

  • allanallan Posts: 61,840Questions: 1Answers: 10,134 Site admin

    I've just committed the following which will be included on the site when I next deploy it (tomorrow):

    Order sequence

    When ordering columns by clicking on their header element, in v1 it would simply toggle between ascending and descending ordering for the columns (controllable with the columns.orderSequence option). DataTables 2 introduces a new option to this parameter, an empty string value which represents no ordering. The default has been updated to make use of this and the ordering sequence that is applied when clicking the header cell is now:

    • Ascending
    • Descending
    • No order

    It will repeat that sequence indefinitely as the column header is clicked. As before, it can be controlled using the columns.orderSequence option, and if you wish to restore the default DataTables 1.x behaviour you can do so by setting the default:

    DataTable.defaults.column.orderSequence = ['asc', 'desc'];
    

    Allan

  • brianjaikens-mslbrianjaikens-msl Posts: 6Questions: 2Answers: 0

    This is wonderful Allan. Thank you for the clarification and the speed of reply.

Sign In or Register to comment.