How to reset sort order

How to reset sort order

lenamtllenamtl Posts: 138Questions: 39Answers: 1
edited January 10 in Free community support

Let say I have this
"order": [[ 10, "asc" ],[ 0, "asc" ], [ 6, "asc" ], [ 7, "asc" ],[ 8, "desc" ]],

and I'd like to have a button that reset only that

let say to this
"order": [ ],

I need this mostly because I have a lot of column that are hidden by responsive
so if a column have an ASC order and is hidden by responsive toggle there is no easy way to reset it.
the only solution is to hide previous column, now the column is visible and we can see that is ordered or not.

So i'd like to offer a quick way for the user to reset the all, or if possible per column that can be another solution.

Thanks

Answers

  • lenamtllenamtl Posts: 138Questions: 39Answers: 1
    edited January 10

    Hi,
    I have tested using this table.order.neutral().draw();
    but it seem to reset to the initial value, what i want is no sort order is this possible?

    $('#resetsort').click( function() {
            table.order.neutral().draw();
        });
    
  • colincolin Posts: 5,359Questions: 0Answers: 932

    Hi @lenamtl ,

    As you can see here, when that order.neutral() is called, it does reset to the order that the original data is in. This is what I would expect. What do you mean by "no sort order"?

    Cheers,

    Colin

  • lenamtllenamtl Posts: 138Questions: 39Answers: 1
    edited January 11

    ok yes it's working fine now..

    I'm wondering is this possible to reset per column only ?

    or to set a new value let say

    "order": [ 0, "desc" ],

    I may implement a sort panel ASC/DESC per column similar to the view/hide column
    (never see this, maybe someone have already implement this)

    As with responsive we don't have the ability to reorder by item that are hidden by the toggle... So if there is any other way I'd like to know how..

Sign In or Register to comment.