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
GNU General Public License v3.0
213 stars 26 forks source link

since update to v0.7.4 - error: "cannot set properties of null (setting 'onclick')" #117

Open PeterKawa opened 12 months ago

PeterKawa commented 12 months ago

Hi,

Since version v0.7.4 I get this error in lovelace cards where i use flex-table-card in combination with auto-entities card: cannot set properties of null (setting 'onclick') When I install v0.7.3 again there's no error whatsoever.

YAML of one such card:

type: custom:auto-entities
filter:
  include:
    - entity_id: switch.*
      state: 'on'
  exclude:
    - entity_id: switch.*kaar*
    - entity_id: switch.*kers*
    - entity_id: switch.*lant*
    - entity_id: switch.rol*
    - entity_id: switch.*led*
    - entity_id: switch.*lamp*
    - entity_id: switch.*cloud*
    - entity_id: sensor.*state*
    - entity_id: curtain.8
card:
  type: custom:flex-table-card
  max_rows: 35
  strict: true
  clickable: true
  title: (flex-table + auto-entities)
  css:
    table+: 'border: 20;'
  columns:
    - name: ''
      data: name
      icon: mdi:lightbulb-alert-outline
      suffix: ''
      align: center
    - name: ''
      data: state
      icon: mdi:lightbulb-on-10
      align: right
    - name: Last update
      data: last_updated
      suffix: ' hrs'
      fmt: hours_passed
    - name: Last update
      data: last_updated
      suffix: ' min'
      modify: Math.round(((Date.now() - Date.parse(x)) / 36000.) * 0.6 )
sort:
  method: friendly_name
  reverse: false
  numeric: false
  ignore_case: true

Screenshot of error: image

When editing the card, it shows no error at the bottom, but the preview on the right only shows an alert: image

Thanks in advance, Peter

EdLeckert commented 12 months ago

The workaround is to put a space between the quotes in the name field: ' ' vs ''. See #115.

The fix is in place in the latest version of flex-table-card.js in the repo, so alternatively you could grab that if you like, especially if you want to use any HTML in the name field. It has not been packaged into a release yet for some reason, but hopefully will be soon.

kbrown01 commented 12 months ago

I assume this means that the fix will repair this (as any HTML in the name breaks the card).

- name: <div title="Games Played">GP</div>

I posted this in the HA here

Link to issue

EdLeckert commented 12 months ago

@kbrown01: Yes, it is related to the column sorting feature and is fixed in the master branch. You can grab it from there if you need it quickly.

@daringer: Any chance of a new release to get this hotfix #116 out?

daringer commented 11 months ago

jup jup, thanks for fixing that, will try to test & release today