Bootstrap 表:是否可以从代码中调用按列对行进行排序的函数(无需单击标题) [英] Bootstrap table: is it possible to call the function which sorts rows by column from code (without clicking the header)
本文介绍了Bootstrap 表:是否可以从代码中调用按列对行进行排序的函数(无需单击标题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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 this fiddle is an example of a table. When you click the header, the table is sorted by the column belonging to that header.
我的问题是,是否有可能以其他方式触发该功能 - 从其他功能.更一般地说:我可以显式调用从各种引导程序小部件中作为回调调用的函数吗?
My question is, if it's possible to trigger that function in some other way - from some other function. More generally: can I explicitly call the functions which are called as callbacks from various bootstrap widgets?
推荐答案
您可以以编程方式单击标题.这能达到你想要的效果吗?
You could programatically click the header. Does this achieve what you want?
$("th[data-field='fruit'] .sortable").click();
这篇关于Bootstrap 表:是否可以从代码中调用按列对行进行排序的函数(无需单击标题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文