flex-table-card icon indicating copy to clipboard operation
flex-table-card copied to clipboard

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

Open PeterKawa opened this issue 8 months ago • 4 comments

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

PeterKawa avatar Nov 16 '23 04:11 PeterKawa

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.

EdLeckert avatar Nov 16 '23 14:11 EdLeckert

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

kbrown01 avatar Nov 17 '23 01:11 kbrown01

@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?

EdLeckert avatar Nov 17 '23 18:11 EdLeckert

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

daringer avatar Nov 21 '23 13:11 daringer