Skip to content

Unable to load the table #238

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

Closed
sangnguyenplus opened this issue Apr 29, 2025 · 6 comments
Closed

Unable to load the table #238

sangnguyenplus opened this issue Apr 29, 2025 · 6 comments

Comments

@sangnguyenplus
Copy link
Contributor

Our tables don't load after upgrading to version 12.0.2.

I think it has issue when switch to use DOMContentLoaded event #237

Before:

Image

After:

Image

We are using tabler.io for admin template, maybe it has conflicted.

@Seb33300
Copy link
Contributor

Hi @sangnguyenplus,
How are you loading DataTables lib and init script on your pages?
Do you use webpack, vite or any module builder? or by using CDN?

@Seb33300
Copy link
Contributor

And can you reproduce the issue with all browsers? Or only with Safari or Google Chrome or ...?

@Seb33300
Copy link
Contributor

Seb33300 commented Apr 29, 2025

I have checked the tabler.io example template and I can see al script are loaded with async.
async should not be used when the script depends on other scripts on the page (in our case, the DataTables init script) and you should use defer instead.
See https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script#async_and_defer

@sangnguyenplus
Copy link
Contributor Author

Hi @Seb33300,

Actually, I don't know why that DOMContentLoaded event is not trigged.

I have to fixed version to v12.0.1 because v12.0.2 has breaking change on script code.

Image

I use this way https://yajrabox.com/docs/laravel-datatables/12.0/buttons-starter to load our tables.

@Seb33300
Copy link
Contributor

Hi @sangnguyenplus,
Do you have any error in the JavaScript console (when you press F12).
Can you please share the error you see?

And can you please also share HTML source where you include the dataTables js lib?
In the documentation link you shared, it only includes dataTables.buttons.min.js and buttons.server-side.js but not the main dataTables lib.

@sangnguyenplus
Copy link
Contributor Author

Hi @sangnguyenplus, Do you have any error in the JavaScript console (when you press F12). Can you please share the error you see?

And can you please also share HTML source where you include the dataTables js lib? In the documentation link you shared, it only includes dataTables.buttons.min.js and buttons.server-side.js but not the main dataTables lib.

It has no issues in JS console. It was working before for me. I'm using it in our Botble CMS and our code was working fine for many years.

It just can't listen to event DOMContentLoaded.

Image

I will override script.blade.php from /resources/vendor to prevent this issue.

You can close this issue.

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

No branches or pull requests

2 participants