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 sorting to tables #300

Open
Laoujin opened this issue Dec 4, 2024 · 2 comments
Open

Add sorting to tables #300

Laoujin opened this issue Dec 4, 2024 · 2 comments

Comments

@Laoujin
Copy link
Member

Laoujin commented Dec 4, 2024

Allow sorting on tables.

For consultant names: should be able to sort on last name and first name.

Or maybe we need to display consulants like "LastName FirstName" instead --> to be checked with back office (check met Jelle)
(or maybe this could be configuration?)

@Laoujin
Copy link
Member Author

Laoujin commented Dec 26, 2024

Hover over the th cell --> show sort icons
Click on sort icons to toggle between: no sort, asc, desc

If no sorting is present then use the custom or default sort (this is sometimes a special sorting, ex in Projects)
If it makes no sense, return null to disable sorting on this column.

{
    key: 'type',
    value: m => t(`consultant.types.${m.type}`),
    // no sort present, sort on the value
}

{
    key: 'buttons',
    header: {title: '', width: 110},
    value: m => <EditIcon onClick={`/consultants/${m.slug || m._id}`} style={{marginRight: 15}} size={1} />,
    // makes no sense to sort on this column, return null to disable sorting for the column
    sort: null
  }

For sorting, check the type of the object to decide how to sort:

  • numbers --> weird in javascript!! (ex: sort [1, 10, 100]...)
  • dates/moments --> valueOf
  • strings --> localeCompare
  • etc...

Optional:
Sort on multiple columns by pressing shift + click

@Laoujin
Copy link
Member Author

Laoujin commented Jan 14, 2025

Belangrijk: bij project months: sorteren op "Project" (eerste kolom) --> sorteer op "consultant.firstName consultant.lastName"

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