dmulcahey / zha-network-card

Custom Lovelace card that displays ZHA network and device information
GNU General Public License v3.0
100 stars 18 forks source link

Sorting Options #33

Open jhemak opened 8 months ago

jhemak commented 8 months ago

Is there a way to specify two fields to sort on? For example, first by availability and then by name? I have tried various ways but have not been able to get that to work. Thank you!

StancuFlorin commented 5 months ago

This is already implemented in flex-table-card https://github.com/custom-cards/flex-table-card/blob/master/docs/example-cfg-sorting-strict.md

jhemak commented 5 months ago

Thanks, I came across that earlier but it doesn't seem to work for me. Do you have a working example?

This works ... in alphabetical order

clickable: true
columns:
  - name: Name
    prop: name
  - attr: available
    id: available
    modify: x || "false"
    name: Online
  - attr: rssi
    name: RSSI
  - name: NWK
    prop: nwk
sort_by: 
  - name
type: custom:zha-network-card

This works ... in numeric order from worst connection to best

clickable: true
columns:
  - name: Name
    prop: name
  - attr: available
    id: available
    modify: x || "false"
    name: Online
  - attr: rssi
    name: RSSI
  - name: NWK
    prop: nwk
sort_by: 
  - rssi
type: custom:zha-network-card

This does not ... neither alphabetical on name nor in numeric order on RSSI ... seems essentially a random order.

clickable: true
columns:
  - name: Name
    prop: name
  - attr: available
    id: available
    modify: x || "false"
    name: Online
  - attr: rssi
    name: RSSI
  - name: NWK
    prop: nwk
sort_by: 
  - rssi
  - name
type: custom:zha-network-card
jhemak commented 4 months ago

@StancuFlorin just circling back here - any idea what I am doing wrong? Thanks!