Topic: I want Event Listener for MDB Data Table Sorting
I Tried following Javascript code but it was not working properly **document.getElementById('datatable').addEventListener('sort.mdb.datatable', (e) => { console.log('Sorting event triggered'); console.log('Column index:', e.detail.columnIndex); console.log('Order:', e.detail.order); // 'asc' or 'desc'
}); **
Kamila Pieńkowska staff answered 2 months ago
Here is a list of availible events: https://mdbootstrap.com/docs/standard/data/datatables/#api-section-events
We do not provide sort.mdb.datatable
event. If you want to listen to the sorting done by the user you need to add custom listeners to icons used for triggering sort operation.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 3.10.0
- Device: Laptop
- Browser: Chrome
- OS: Windows
- Provided sample code: No
- Provided link: No