order.listener() with complex header

order.listener() with complex header

kthorngrenkthorngren Posts: 21,722Questions: 26Answers: 5,027
edited March 1 in DataTables 2

I'm trying to workout how to use order.listener() with complex headers. Trying to set the listener to use only the icon for the Position th in this test case:
https://live.datatables.net/kekazaxo/1/edit

Using this code:

let th = table.column(1).header(0);
$( th ).attr('data-dt-order', 'icon-only');
table.order.listener( $('span.dt-column-order', th), 1);

The listener is set properly but the dt-ordering-[asc|desc] class is not applied and the sorting icon is not updated. Do I need to do something differently?

FYI, I was trying to provide an example in this thread.

Kevin

Sign In or Register to comment.