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

Add key string to custom Sort parameters for reuse of sorting function #65

Open
MishiRover opened this issue May 11, 2018 · 0 comments
Open

Comments

@MishiRover
Copy link

MishiRover commented May 11, 2018

Would it be possible to add a key definition to the custom sort parameters so that we are able to reuse the sort function for multiple columns? This would be useful for 2+ date columns, for example.

dateSort(a, b, sortOrder, key) {
        let date1 = new Date(a[key]);
        let date2 = new Date(b[key]);

        if (date1 === date2) {
            return 0;
        }

        if (date1 > date2) {
            return 1 * sortOrder;
        }

        return -1 * sortOrder;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant