Refresh data table from Stimulus controller #248
Replies: 2 comments
-
|
It is, when you're using Turbo! Make sure you're following the section "Server-side responses for Turbo Frames" in this guide: https://data-table-bundle.swroblewski.pl/docs/features/asynchronicity.html The magic is this code part in your controller: if ($dataTable->isRequestFromTurboFrame()) {
// Return only the table's HTML so Turbo can replace the requesting <turbo-frame>
return $this->createDataTableTurboResponse($dataTable);
}Now you can call the following from your Stimulus controller to replace just the data table turbo frame: Turbo.visit(window.location.href, {
frame: this.turboFrameValue,
})
<twig:MyDeleteDialogComponent
{{ ...stimulus_controller('data-table-action-form', {
'turbo-frame': 'kreyu_data_table_' ~ data_table.vars.name,
}) }}
>
{# some contents #}
</twig:MyDeleteDialogComponent> |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
check it @karheda |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi.
It's possible to refresh a data table from a custom Symfony or Stimulus controller?
Beta Was this translation helpful? Give feedback.
All reactions