gridjs icon indicating copy to clipboard operation
gridjs copied to clipboard

[Feature request] Initial sorting / Sort methods

Open bruno-buiret opened this issue 2 years ago • 7 comments

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!

bruno-buiret avatar Dec 09 '22 08:12 bruno-buiret

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.

somegooser avatar Jan 01 '23 15:01 somegooser

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?

nk9 avatar May 01 '23 07:05 nk9

would like this

mrmikeo avatar Oct 13 '23 09:10 mrmikeo

This would be great indeed

lennart-jaervinen avatar Oct 27 '23 14:10 lennart-jaervinen

this would be helpful

handmethemyc avatar Dec 14 '23 11:12 handmethemyc

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';
    }
}

joeskeen avatar Feb 03 '24 11:02 joeskeen

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.

bruno-buiret avatar Feb 03 '24 15:02 bruno-buiret