custom-cards / flex-table-card

Highly Flexible Lovelace Card - arbitrary contents/columns/rows, regex matched, perfect to show appdaemon created content and anything breaking out of the entity_id + attributes concept

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

column sorting problem

arifroni opened this issue · comments

hello, I am trying to make a table with some sensors with yearly energy value. but for some reason, the sorting is not working.

https://imgur.com/2zYJbY9

Also instead of a friendly name of a sensor, is it possible to use a custom name of the sensor?

Hi ya, Great card. Well done. Not sure if this is the same issue or not as I can't see @arifroni image.
The sorting problem I'm having is with percentages. It is the age old problem where 100% is seen as before 20% because it starts with a 1 and 20% starts with a 2. For example
Untitled
It also happens when I sort by IP Address
Untitled1
And I'm not sure what is going on when I sort by dBm ?
Untitled2

Hi ya, Great card. Well done. Not sure if this is the same issue or not as I can't see @arifroni image.
The sorting problem I'm having is with percentages. It is the age old problem where 100% is seen as before 20% because it starts with a 1 and 20% starts with a 2. For example
Untitled
It also happens when I sort by IP Address
Untitled1
And I'm not sure what is going on when I sort by dBm ?
Untitled2

you are absolutely right about the sorting procedure. I still haven't found any solution. if you do, please let me know here.

I think the fix is with @daringer to modify the code

hey @arifroni - if your interested I've modified the original js to make it work properly with sorting numbers and IP addresses

@muzzak123 yes please :)

Here it is - no guarantees or support 😃
flex-table-card.js.txt

  • save this file over the top of the existing one in \config\www\community\flex-table-card\flex-table-card.js (make sure to give it the same name)
  • delete the file flex-table-card.js.gz in the same directory
  • and then refresh your table in your browser

hopefully that will work

Feel free to make this a proper PR so all can use it.
(sorry, didn't have time to look into it by myself)

OK - never done that but I'll give it a shot

its sorting the values as it should. nice work @muzzak123
another question, is it possible to set name to individual entities? i don't want the friendly name to be shown on the table.
image

@daringer Pull request created I think/hope I did it right.

@arifroni Your "friendly" names don't look very friendly. I would suggest you change the friendly names on your entities to what you want, like "Yearly Energy TV" and then show those. After all that's why there called friendly names.
Also this thread is about your sorting issue, so probably not the right place to be asking questions about other things like this.