I am working with DataTables version 2.1.8 and have encountered a challenge.
I am working with DataTables version 2.1.8 and have encountered a challenge.
I am working with DataTables version 2.1.8 and have encountered a challenge. After fetching data via an API and reloading the table, I want to utilize the table.columns.adjust() feature to ensure proper column adjustments. However, I’m unsure of the best way to implement this in the latest version.
Here’s what I’m trying to achieve:
Fetch data from an API and update the DataTable.
Automatically adjust the columns to fit the new data using table.columns.adjust().
Could you please guide me on the correct approach to achieve this in DataTables 2.1.8? Any examples or documentation links would be greatly appreciated.
Thank you in advance for your help!
Answers
Assuming you are Ajax loading the data (
ajax
) then use:If you aren't using Ajax and just loading the data using
clear()
androws.add()
:Allan
load user function
I'm encountering an alignment issue between the column widths of the header and the body in the table. The header columns and body columns are not aligning properly, which affects the table's visual consistency and usability.
Could you try the nightly build of DataTables please? There is an error when using server-side processing and column alignment in 2.1.8.
Allan
I’m currently using DataTables v1 with Angular 18 and Bootstrap 5, and it’s working perfectly. However, I’m encountering challenges while migrating to DataTables v2. Could you recommend the best compatible version for Angular 18 and Bootstrap 5? Additionally, any examples or documentation to assist with the migration would be greatly appreciated
The nightbuild theme is not suitable for my project (need a light theme). Right now I tried to migrate Datatable V2.1.8 with Angular 18 and Bootstartp 5. Api is working fine here; the issue is that after the api response, the cloumn size is not adjustable properly and the fixed header and fixedcloumns extension is not working correctly.
Upgrade notes for v2 are available here. I don't provide an official Angular integration for DataTables I'm afraid - I can't really help you on that front.
Perhaps if you link to a test case showing the issue I might be able to identify a problem.
Allan