FEATURE REQUEST: order option [index, 'asc'|'desc'] should allow any column selector, not just index

FEATURE REQUEST: order option [index, 'asc'|'desc'] should allow any column selector, not just index

loukinglouking Posts: 259Questions: 52Answers: 0

In particular, would like to see {string}:name selector allowed. Alternatively, allow 'order' option directly under the columns option, with 'asc', 'desc' as value (assume current index).

I've removed a hidden column from my home-grown underlying framework, and this has broken all of the datatable options which have order option based on index.

Replies

  • tangerinetangerine Posts: 3,348Questions: 36Answers: 394

    DataTables allows initial ordering by any permutation of columns.
    https://datatables.net/reference/option/order

    Unless I'm misunderstanding the question....

  • loukinglouking Posts: 259Questions: 52Answers: 0
    edited August 2020

    Yes, misunderstanding, I think. In the example

    $('#example').dataTable( {
        "order": [[ 0, 'asc' ], [ 1, 'asc' ]]
    } );
    

    would like to be something like

    $('#example').dataTable( {
        "order": [[ 'col1:name', 'asc' ], [ 'col2:name', 'asc' ]]
    } );
    

    instead

  • allanallan Posts: 61,686Questions: 1Answers: 10,100 Site admin

    Yup - good request. It is something that is on my radar already, so good to know that this would be useful.

    Allan

This discussion has been closed.