Skip to content

Commit

Permalink
Merge pull request #102 from EdLeckert/bug-single-entity-rows-not-cli…
Browse files Browse the repository at this point in the history
…ckable

fixed #101 - Single entity rows not clickable after first row
  • Loading branch information
daringer authored Sep 1, 2023
2 parents 779a9f6 + cc8e1e4 commit d93f6cf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions flex-table-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,15 +534,15 @@ class FlexTableCard extends HTMLElement {

_updateContent(element, rows) {
// callback for updating the cell-contents
element.innerHTML = rows.map((row) =>
`<tr id="entity_row_${row.entity.entity_id}">${row.data.map(
element.innerHTML = rows.map((row, index) =>
`<tr id="entity_row_${row.entity.entity_id}_${index}">${row.data.map(
(cell) => ((!cell.hide) ?
`<td class="${cell.css}">${cell.pre}${cell.content}${cell.suf}</td>` : "")
).join("")}</tr>`).join("");

// if configured, set clickable row to show entity popup-dialog
rows.forEach(row => {
const elem = this.shadowRoot.getElementById(`entity_row_${row.entity.entity_id}`);
rows.forEach((row, index) => {
const elem = this.shadowRoot.getElementById(`entity_row_${row.entity.entity_id}_${index}`);
// bind click()-handler to row (if configured)
elem.onclick = (this.tbl.cfg.clickable) ? (function(clk_ev) {
// create and fire 'details-view' signal
Expand Down

0 comments on commit d93f6cf

Please sign in to comment.