How to combine user sorting with system sorting

How to combine user sorting with system sorting

CBolandCBoland Posts: 9Questions: 3Answers: 0
edited June 2015 in Free community support

Given a table with three columns: A, B, C. Columns A and B are visible and sortable by the user, column C is hidden and contains related data. When the user clicks the column header to sort the data, we want to also sort by column C in ascending order.

Example: User sorts by column A asc. The sort to apply will be A asc, C asc.
Example: User sorts by column B desc. The sort to apply will be B desc, C asc.

I tried the examples for columns.orderData with some success. The grid can be sorted by multiple columns this way, the sort direction is the same for all columns, e.g. sorting by A asc, the sort applied will be A asc, C asc; sorting by B desc, the sort applied will be B desc, C desc. I need control over the sort direction, too.

I also tried the example for columns.orderData listed on docs page for Multi-Column Ordering, but this JS error is thrown:

Uncaught TypeError: Cannot read property 'sType' of undefined at jquery.dataTables.js:4299

I'm using DataTables 1.10.8-dev from GitHub as of 6/22/2015.

Can someone help?

This discussion has been closed.