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

Sorting not working (maybe bug, maybe FR) #126

Open
AleXSR700 opened this issue Jan 3, 2024 · 3 comments
Open

Sorting not working (maybe bug, maybe FR) #126

AleXSR700 opened this issue Jan 3, 2024 · 3 comments

Comments

@AleXSR700
Copy link

It seems that sorting only works on attributes that are being displayed in the table rather than all attributes of the entity that is being displayed.

I am displaying only the state but this seems to mean that I can only sort by state and not by friendly_name of the entity who's state I am displaying.

  - type: custom:flex-table-card
    entities:
      include:
        - sensor.eq3*valve
    sort_by: friendly_name
    columns:
      - name: <div>Valve<br><br>%</div>
        data: state

So even though the included entities all have friendly_names, sorting does nothing except when sorting by state (the only attribute being displayed).

Ideally, like in auto-entities, sorting should be possible by any attribute of the entities selected in include.

Would that be possible?

Or is that maybe even the intended way?

Thank you
Alex

@ildar170975
Copy link
Contributor

ildar170975 commented Jan 4, 2024

It seems that sorting only works on attributes that are being displayed in the table rather than all attributes of the entity that is being displayed.

Seems to be by a design. As it was specified in Docs:

image

@daringer
Is it an intended behaviour?

@AleXSR700
You may add a column with "friendly_name" & then hide it.
Or (could be better) use auto-entities as a filter & specify sort there.
Plenty of ways.

@AleXSR700
Copy link
Author

AleXSR700 commented Jan 4, 2024

@ildar170975
I had tried adding friendly_name and then hiding it, but it seems my way of hiding was incorrect because I could not find a way to actually hide it. Only to basically create an empty friendly_name column and replacing all characters, i.e. creating an empty column.
However, sorting by friendly_name does not sort by friendly_name but actually sorts by the modified friendly_name.
So using e.g.
modify: x.replace(/./g, ' ')
creates an empty column but since there are no more characters to sort by, the sorting does not work.
Is there a way of creating a column and hiding it?

But I now saw that there is a feature hidden: true, so that should do the trick :)
EDIT:
I saw the instructions on sorting, but essentially the sorting can be performed by any of the columns' attributes. So no the column's attribute but columns' attributes.
So I guess yes, the instructions suggest that the sort order can only be based on one of the attributes used in the column.

That would of course, if true, turn this "issue" into a "feature request" :)

@AleXSR700
Copy link
Author

But I now saw that there is a feature hidden: true, so that should do the trick :)

Yes, did not see that originally -.-

So I would say it is now a feature request to be able to sort by any attribute of the entities specified, even if they are not in any column.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants