Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed #101 - Single entity rows not clickable after first row #102

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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