javascript - Bootstrap table: is it possible to call the function which sorts rows by column from code (without clicking the header) -
http://jsfiddle.net/e3nk137y/4537/
<table data-toggle="table" > <thead> <tr> <th data-field="fruit" data-sortable="true">item</th> <th data-field="date" data-sortable="true">date</th> <th data-field="type" data-sortable="true">type</th> </tr> </thead> <tbody> <tr><td>pear </td><td data-month="1">january</td> <td>fruit</td></tr> <tr><td>carrot</td><td data-month="3">march</td> <td>vegetable</td></tr> <tr><td>apple </td><td data-month="2">february</td><td>fruit</td></tr> </tbody> </table>
in fiddle example of table. when click header, table sorted column belonging header.
my question is, if it's possible trigger function in other way - other function. more generally: can explicitly call functions called callbacks various bootstrap widgets?
you programatically click header. achieve want?
$("th[data-field='fruit'] .sortable").click();
Comments
Post a Comment