2

I use the excellent "footable" plugin. I can sort the table by clicking on the header, but how to tell to "footable" : sort this table with this column just after the page is loaded ?

I tried with this keyword : data-sort-initial, without success :

 <thead>
                    <tr>
                        <th data-type="html" data-sort-use="text" data-sort-initial="ascending">Code</th>
                        <th>Libellé</th>

                    </tr>
                </thead>

My goal is to have this table just after the loading :

enter image description here

With the "sorted icon" displayed in the header. How to do that ?

my js is simple :

$(function () {
    $('.footable').footable();
});

Thanks for your ideas. Merci

dominique

Dom
  • 2,984
  • 3
  • 34
  • 64

2 Answers2

3

Found the answer.

<th data-type="html" data-sort-use="text" data-sorted="true" data-direction="ASC">Code</th>
Divi
  • 7,621
  • 13
  • 47
  • 63
Dom
  • 2,984
  • 3
  • 34
  • 64
2

you must add to the column the tag: data-sorted="true"

like this:

<th data-type="html" data-sort-use="text" data-sort-initial="ascending" data-sorted="true">Code</th>