Skip to content

Reset sorting to default (or nothing) on external event #1260

Open
@Sigfried

Description

@Sigfried

I've read #590 but don't really understand the outcome. However, at some point in that discussion, I think @jbetancur asked what the use case is. My use case is this: I have this kind of crazy but very useful nested data table:
image

Because of the nesting, sorting has to be done at each indent level, and I do that through my initial sorting of the data and I set sortable: false on all columns. However, sometimes the user does want to sort, so I allow them to turn nesting off and then the columns toggle to sortable: true. But when they turn nesting back on, the table stays sorted, which means the nesting makes no sense:
image

I would just like to tell the table to go back to it's initial state. I tried forcing a rerender by replacing data with a copy ([...data]), but that's not doing anything.

In writing this issue, I did figure out a klunky workaround: in my event handler for toggling nesting back on, window.location.reload().

So, maybe I misunderstood and there's already a way to do this without that workaround, or maybe this use case is argument enough for implementing a reset feature, but, with the workaround, it's not a dire situation for me.

Thanks for the component! It's helped me a lot over the years.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions