Custom sorting function in google chart table
1 answer
Capture the sort event with an event handler:
// table is your Table visualization
google.visualization.events.addListener(table, 'sort', function (e) {
// e.column is the column to sort
// e.ascending is a boolean, true for ascending sort, false for descending sort
// sort your data
// if you want the ascending/descending elements to work correctly, you need to specify the Table sortColumn and sortAscending options when you redraw the Table, eg:
options.sortColumn = e.column;
options.sortAscending = e.ascending;
table.draw(sortedData, options);
});
+1
source to share