I have two, independent, stimulus controllers. One that manages a table and one that is used to trigger a new row for the table.
I have a button on the page that calls the turbo-table-new-row#show function, which does dispatch the event and the turbo-table#show function is called, but I don't seem to have access to the turbo-table's 'this', so I'm unable to access the targets, values, etc...
If I move the button into the turbo-table's scope, I don't need the second controller, and everything works. However, from the UI perspective, this isn't workable.
How do I get access to the receiving controller's 'this' after receiving the event?
<div data-controller="turbo-table-new-row turbo-table"
data-action="turbo-table-new-row:show->turbo-table#display">
<button data-action="click->turbo-table-new-row#show">
</div>
// turbo-table-new-row-controller
show(e) {
this.dispatch("show", { detail: { url: e.params.url} })
}
// turbo-table-controller
show(e) {
console.log("[turbo_table] - turbo-table-new-row->show event")
console.log(e.detail.url)
// I don't have access to the turbo-table-contoller 'this'
this.hasPanelTarget ...
}