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

Items per page change not working with Turbo #153

Closed
davidromani opened this issue Nov 29, 2024 · 3 comments · Fixed by #155
Closed

Items per page change not working with Turbo #153

davidromani opened this issue Nov 29, 2024 · 3 comments · Fixed by #155

Comments

@davidromani
Copy link

davidromani commented Nov 29, 2024

Since {% block kreyu_data_table %} is adding a <turbo-frame> wrapper, it seems that when you change the items per page selected amount is doing a full page reload (instead of an asynchronous call to replace only the turbo frame content).

Is this situation considered as a bug? And can be fixed?

@Kreyu
Copy link
Owner

Kreyu commented Nov 29, 2024

Hey!

By default, the per-page selector is rendered with the onchange="this.form.submit()" attribute. I think this is not working properly with Turbo, but based on the https://stackoverflow.com/a/69537709 - probably changing it to this.form.requestSubmit() will work just fine. I'll check it.

@Kreyu
Copy link
Owner

Kreyu commented Nov 29, 2024

Fixed in v0.25.7.

The per-page form now contains new data attribute data-turbo-frame="_self" and its select control has onchange="this.form.requestSubmit()" data attribute. This makes the form submission asynchronous with Turbo.

Thanks for the report!

@Kreyu
Copy link
Owner

Kreyu commented Dec 6, 2024

FYI: I've found another issue with the items per page selector & Turbo - the url query parameter is not updating upon submit. Will fix that in #158

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants