Skip to content

New "clickable" property for <ha-data-table>#7351

Merged
bramkragten merged 1 commit intohome-assistant:devfrom
spacegaier:clickable-table
Oct 15, 2020
Merged

New "clickable" property for <ha-data-table>#7351
bramkragten merged 1 commit intohome-assistant:devfrom
spacegaier:clickable-table

Conversation

@spacegaier
Copy link
Member

Breaking change

Proposed change

New property so that a <ha-data-table> can be marked as clickable and therefore the pointer cursor is used.

An additional future change could be to make that a per row settings, in case only specific rows should be clickable. Not sure if we will have such a use-case, so this MVP is without such support.

I verified varies points:

  1. Mouse cursor is correctly shown where the new property is set
  2. Rows with checkboxes work just as fine as they did before (e.g. entity table)
  3. Tables that have not set the new property remain with the old cursor (e.g. scenes and automations)

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:


@property({ type: Boolean }) public selectable = false;

@property({ type: Boolean }) public clickable = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the name clickable, but don't really have a good alternative either.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me it makes sense since the event is also called @click and that is basically what the new property is logically tied to. Would be even nicer, if we could detect if that event callback is attached, but I did not find a way to do so.

@bramkragten bramkragten merged commit 47f0d74 into home-assistant:dev Oct 15, 2020
@spacegaier spacegaier deleted the clickable-table branch October 15, 2020 13:59
@bramkragten bramkragten mentioned this pull request Oct 21, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make resources visibly clickable in Lovelace Dashboards resource editor

3 participants