Currently sorted column [tablesort.$th] is never updated and is always null. This is needed when data in the table are reloaded with ajax and user-selected sorting needs to be reapplied.
Proposed fix:
//click on a different column if (this.index !== th.index()) { this.direction = 'asc'; this.index = th.index(); this.$th = th; }