-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Sort media sources #6960
Sort media sources #6960
Conversation
` | ||
)} | ||
${this._params.mediaSources | ||
.sort() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to sort by name right? So need a sort function that compares the name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes?
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
@@ -56,7 +56,8 @@ export class HuiDialogSelectMediaPlayer extends LitElement { | |||
)}</paper-item | |||
> | |||
${this._params.mediaSources | |||
.sort() | |||
.sort((a, b) => | |||
compare(a.attributes.friendly_name || "", b.attributes.friendly_name || "")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compare(a.attributes.friendly_name || "", b.attributes.friendly_name || "")) | |
compare(computeStateName(a), computeStateName(b))) |
Breaking change
Proposed change
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: