How to get (original) column index of column clicked after ColReorder

How to get (original) column index of column clicked after ColReorder

djmdjm Posts: 20Questions: 4Answers: 0

Hello.

http://jsfiddle.net/b8xn0j12/21/

Works fine if the columns remain in the same order.
If we use ColReorder and the user moves the columns around, then this code reports different (index) values for the (same) column selected.
How can I uniquely determine when the user clicks on a column which (original) index this column originally had (before the user moved it around).

Many thanks in Advance.

Answers

  • djmdjm Posts: 20Questions: 4Answers: 0
    edited December 2014

    If I were to assign a "name" this would stay independent of the user sorting the columns.
    How can I access this name in the on click handler for the column header?

    https://datatables.net/reference/option/columns.name

     $("#example").find("thead").on('click', 'th', function() 
          {
               var Col =  Table.column(this);
              // how do I access original column index or "name" here ??
          });
    
This discussion has been closed.