Topic: DataTable "ALL" pagination option not working
scottwilliams priority asked 8 months ago
Expected behavior
Expect a functioning "ALL" option to be added to the table pagination.
Actual behavior
Throws a JSON parsing error in the console and stops the table from being rendered. This is using data-attributes according to the documentation.
Resources (screenshots, code snippets etc.)
Snippet: https://mdbootstrap.com/snippets/standard/kellyjromer/5996192
Console Error:
Uncaught SyntaxError: Unexpected token ''', "[10, 25, 50, 'ALL']" is not valid JSON
at JSON.parse (<anonymous>)
at br._getOptions (mdb.umd.min.js:291:36943)
at new br (mdb.umd.min.js:291:31641)
at 5996192:77:26
_getOptions @ mdb.umd.min.js:291
br @ mdb.umd.min.js:291
(anonymous) @ 5996192:77
The error happens with 'ALL' or ALL in the array.
Kamila Pieńkowska staff answered 8 months ago
Here is how to use it: https://mdbootstrap.com/snippets/standard/kpienkowska/5996992
Alternatively you can set datatable options with JS since you initiate it with JS anyway.
scottwilliams priority answered 8 months ago
Yep now it's working. Thanks. It was the use of ' ' and " " in the wrong order that was breaking it. Maybe a notation in the documentation would help avoid an issue for others in the future? Thanks again!
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Priority
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 7.1.0
- Device: Macbook Pro
- Browser: Chrome
- OS: MacOS Sonoma 14.3
- Provided sample code: No
- Provided link: Yes