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 options for default column order #2504

Open
3 tasks done
theolundqvist opened this issue Oct 2, 2023 · 4 comments
Open
3 tasks done

Add options for default column order #2504

theolundqvist opened this issue Oct 2, 2023 · 4 comments
Labels
type:feature New feature or improvement of existing feature

Comments

@theolundqvist
Copy link

New Feature / Enhancement Checklist

Current Limitation

With many columns we often want to see ex username and email before other less relevant fields. Currently the four system columns appear first and then the rest of the fields have a random? order.

Feature / Enhancement Description

Forcing the columns to be in the same order that is specified in the columnPreference field. All non-mentioned columns can come in a random order in the end.

  apps: [
    {
      columnPreference: {
        "_User": [
             { name: "objectId" } // first column
             { name: "username" } // second column
         ]
      }
    },
  ],

Example Use Case

All dashboard users store their own ordering in localStorage, but I don't want everyone to need to create their own order for 10ths of classes. It would be good to provide a sensible and customised default for all users.

Alternatives / Workarounds

None which I am aware of.

3rd Party References

@parse-github-assistant
Copy link

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!

@theolundqvist
Copy link
Author

Addition:
I would also want to be able to provide a default ordering for the classes. Maybe even separate them into groups with a horizontal line such as it is done with the system classes.

@mtrezza mtrezza added the type:feature New feature or improvement of existing feature label Oct 2, 2023
@mtrezza
Copy link
Member

mtrezza commented Oct 2, 2023

The auto-sort sorts the rest of the fields alphabetically, not randomly, that's what it's supposed to do anyway.

Did you check whether columnPreference already supports predefined column sorting? It may not be documented in the README but the feature may exist in code.

@theolundqvist
Copy link
Author

theolundqvist commented Oct 3, 2023

I did do some digging but I could try again.

This is what the columns in one of my classes look like in a fresh browser
image
The first four fields are always in the same order and the custom fields does not seem to be in alphabetical order.

Doing this does not affect the order.

columnPreference: {
  "Progress": [{name: "chapter"}, {name: "user"}, {name: "progress"}]
}

It seems to me that this should work based on the code here: ColumnPreference.js:100

First it adds the columns in localstorage, then objectId, then the defaultPrefs and lastly all the others in a convenient order since there is no sorting going on from what I can tell.

Actually..., Safari was probably not as clean as I thought. I opened they dashboard in a new icognito window and this is the result:
image

So it does work.

But there is still a minor problem here. Even if I never added any clientside custom ordering to the Progress class the dashboard saves the order in my localstorage and applies it with priority the next time I open the dashboard. Meaning that server side ordering changes won't affect the client if they ever opened the dashboard before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

2 participants