I am using ktui datatables but in my case sorting is not working why??
Hi
Please check the examples here.
https://github.com/keenthemes/ktui/tree/main/examples/datatable
May I know if you use a local or remote data source?
Thanks
Please check the package.json and verify the KTUI version. Please try to update to the latest version.
npm install @keenthemes/ktui@latest
Thanks
Thanks for the update.
I’ve checked, and the current KTUI theme version is 1.0.25. I tried updating, but unfortunately, the sorting functionality is still not working even with this version.
Sorting issues in KTUI Datatables usually happen when the table data isn’t properly initialized or when dynamic content is loaded after the table is rendered.
Try calling the reinitialization function after loading or updating your data, like:
KTDatatable.init();
Also, make sure your column headers have the correct data-sort attributes, and that the table isn’t inside a hidden tab or container when it's initialized, as that often breaks sorting.
I’ve shared some performance tools and troubleshooting guides that might help:
Thanks for the pointers! I’ve already tried reinitializing and checked the data-sort attributes, but the sorting issue still persists. I’ll review the guides you shared and see if I missed anything.
Hi
sorting isn’t working because the <th> headers lack the required kt-table-col wrapper with kt-table-col-sort and the data-kt-datatable-column is set to a name incompatible with the data structure.
<th scope="col" data-kt-datatable-column="course_name">
<span class="kt-table-col">
<span class="kt-table-col-label">Course Name</span>
<span class="kt-table-col-sort"></span>
</span>
</th>HEllo ,
Same I have implemented in my code but not working, if i copy paste code from here https://ktui.io/docs/datatable but also not working sorting.
here is the code
<th scope="col" class="w-30" data-kt-datatable-column="course_name">
<span class="kt-table-col">
<span class="kt-table-col-label">Course Name</span>
<span class="kt-table-col-sort">
</span>
</span>
</th>
Hi,
Please share your code in https://gist.github.com/
Thanks
Hi,
I have share the code here - https://gist.github.com/bhagyashri-gfi/51a83d9b10d126dea73223baeb83392f