Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Initial sorting / Sort methods #1255

Open
bruno-buiret opened this issue Dec 9, 2022 · 7 comments
Open

[Feature request] Initial sorting / Sort methods #1255

bruno-buiret opened this issue Dec 9, 2022 · 7 comments
Labels
new feature New feature or request

Comments

@bruno-buiret
Copy link

Hello,

Is your feature request related to a problem? Please describe.
I would like if it where possible to programatically define the sorting on a table, at least the initial one like mentionned in #954.

Describe the solution you'd like
Parameters to define the initial sorting like in jQuery DataTables or a method.

Describe alternatives you've considered
I haven't yet found a way to do this.

Thank you!

@somegooser
Copy link

I also have the same problem. My table is sorted by default ASC. When a user clicks on sort it sorts again with ASC first.

@afshinm afshinm added the new feature New feature or request label Jan 1, 2023
@nk9
Copy link

nk9 commented May 1, 2023

Don't want this to be auto-closed, so I'll just say: yes, this would be great. Shouldn't it just be a matter of adding a public API method which takes an array of column names and sort directions and sends a series of requests to this method?

@mrmikeo
Copy link

mrmikeo commented Oct 13, 2023

would like this

@lennart-jaervinen
Copy link

This would be great indeed

@handmethemyc
Copy link

this would be helpful

@joeskeen
Copy link

joeskeen commented Feb 3, 2024

I'd actually like to see this on the Grid config object. Currently the sort property is either boolean or this object:

{
    multiColumn?: boolean;
    server?: {
        url?: (prevUrl: string, columns: TColumnSort[]) => string;
        body?: (prevBody: BodyInit, columns: TColumnSort[]) => BodyInit;
    };
}

I think it would be awesome if we could just add a property like this:

{
    multiColumn?: boolean;
    server?: {
        url?: (prevUrl: string, columns: TColumnSort[]) => string;
        body?: (prevBody: BodyInit, columns: TColumnSort[]) => BodyInit;
    };
    initialSort?: {
        columnId: string;
        direction?: 'asc' | 'desc';
    }
}

@bruno-buiret
Copy link
Author

I'd like to add @joeskeen's idea of an array of {columnId: string, direction?: 'asc' | 'desc'} to handle multi column sorting using the initial config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants