I'm using footable version 2.0.3.
When I'm trying to sort manually with...
$('.footable').data('footable-sort').doSort(4, true)
... I get the following error:
Uncaught TypeError: Cannot read property 'sort' of undefined
at Sort.p.doSort (http://localhost:8080/js/footable.sort.js:125:23)
It's very strange. For example, filter is working $('.footable').data('footable-filter').filter('some text')
, this means there is no problem with my table.
Inspecting the footable code, ft.columns
is empty, so column
is undefined
var $table = $(ft.table),
$tbody = $table.find('> tbody'),
column = ft.columns[columnIndex],
$th = $table.find('> thead > tr:last-child > th:eq(' + columnIndex + ')'),
cls = ft.options.classes.sort,
evt = ft.options.events.sort;
This happens when footable is called twice. Reproduced here in jsfiddle.
$('.footable').footable();