Default sort column by class name?

Default sort column by class name?

Felix11HFelix11H Posts: 2Questions: 1Answers: 0

Hi,

from the discussion here, setting the default sort column by class name was not possible prior to 1.10. Am I correct to assume that this has not changed with the release of 1.10 (DT live)? Has some other functionality coming with 1.10 made this easier in any way?

Many thanks,
Felix

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    edited July 2014 Answer ✓

    There isn't a built in way of doing it, but its fairly trivial to do with a call to $().index():

      var table = $('#example').DataTable( {
        order: [ [ $('th.defaultSort').index(),  'asc' ] ]
      } );
    

    http://live.datatables.net/wefileq/1/edit

    Allan

  • Felix11HFelix11H Posts: 2Questions: 1Answers: 0

    Fantastic Allan, thank you so much!

This discussion has been closed.