Access redom component from dom element #460
-
Is it considered bad practice to reference a redom component using the dom element '__redom_view'? Is there a better / preferred way to do this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
It's what RE:DOM uses internally as well, so i wouldn't say it's bad practice 🤷♂️ |
Beta Was this translation helpful? Give feedback.
-
Great. Thank you. |
Beta Was this translation helpful? Give feedback.
-
I'm probably over-complicating things, but I'll try to explain. No doubt there's a better way to do this.. I am toggling the visibility of buttons in a table cell when the mouse enters / leaves the parent row. When the mouse enters the row, I add the class 'hover', and when the mouse leaves, I remove the class hover. I listen to row click events in the table controller. When the edit button in the cell is clicked, I show an overlay and a dialog for the user to perform an action but the mouseleave event is not triggered because of the overlay. I therefore want to call the 'removeHoverClass' function on the row component from the controller. I could just do clickedRow.classList.remove('hover'), but that feels like it is breaking encapsulation. Like I say, probably over-complicating it. Bet you wish you hadn't asked now 😆 TableCell class:
TableRow class:
Table class:
TableController class:
|
Beta Was this translation helpful? Give feedback.
It's what RE:DOM uses internally as well, so i wouldn't say it's bad practice 🤷♂️