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

table does not automatically update after entity deletion

daringer opened this issue · comments

#103 dramatically helps reducing table updates, nevertheless deleting one entity (click a row in table, choose settings, choose delete) does not reload the table. @EdLeckert we might need to improve the no-update-condition to catch this, ideas?

Generally this is more or less the case that last_updated will stay the same, but the (matched) entities change...

nevertheless deleting one entity (click a row in table, choose settings, choose delete)

Could you elaborate?
How can we "click a row in table, choose settings, choose delete"?

Clicking a row brings up the more-info dialog. Click the gear icon, scroll down to the bottom left, click DELETE. The entity is deleted, but the table does not update.

Already fixed in next PR:

Feel free to test it if you like.

Fixed by:

Check for change of row count before checking max of last_updated.

So, this is about entities made in UI.
Assume we have an entity with an attribute which is a list (each element may be a value or a dictionary).
Then the card will be filled with this list's (array) elements.
Example - a weather entity may have a forecast attribute.
Clicking on any row shows "more-info" for the same entity.

Currently entities which may be created in UI do NOT have list attributes.
But imagine that some forthcoming HA release will allow to create template sensors - and we may create a list attribute there (my guess, cannot check).
And these template sensors - as created in UI - could be deleted in UI too.
So, if this sensor with a list attribute is shown in flex-grid-card - after deletion this sensor all rows should be deleted.

Will it be possible with this PR?
Can a table be empty?

P.S. Now with 0.7.3 the table can be empty:
изображение

@ildar170975:

The situation you describe is exactly what I have done with my wine database integration. A single entity represents the wine inventory, and a single attribute of that entity holds a list of dictionary items, one for each bottle.

Clicking any row brings up the same more-info dialog, as you know. And deleting the entity from that dialog would wipe out the entire inventory, leaving an empty table. So, not particularly useful in this case.

Does that answer your questions?

@EdLeckert
Yes!
Let's say this is a kind of "synthetic" case - but I am glad that you tested it as well!
Thanks a lot for your efforts.

A single entity represents the wine inventory

Now here is a really useful application for the HA )))