Sort programmatically
Sort programmatically
neuDev33
Posts: 11Questions: 0Answers: 0
I've just about started using DataTables and wanted to integrate a custom menu in my table. So far, I've successfully implemented a basic DataTable and gotten my custom menu displayed(by right clicking on column headers). This menu has options for sorting, grouping, hiding columns. I wanted to know how I can sort the datatable when the user clicks on a menu item. I tried
[code]$('#myTable').dataTable({ "aaSorting": [[3, "asc"]] });[/code]
However, this gives me an error saying i cannot reinit the table. Fair enough. But how do i access it's instance and sort it based on any column i wish through code?
[code]$('#myTable').dataTable({ "aaSorting": [[3, "asc"]] });[/code]
However, this gives me an error saying i cannot reinit the table. Fair enough. But how do i access it's instance and sort it based on any column i wish through code?
This discussion has been closed.
Replies
Assign your datatable to a variable and then you can control the sorting through fnSort.
Allan