时间:2021-07-01 10:21:17 帮助过:33人阅读
先搞一个table,使用ajax将数据查询出来,然后可以在所有列都加上排序。满足自己的需求。(推荐学习:Bootstrap视频教程)
data-sortable="true",此属性加到列上面,可以显示出上下排序的箭头。
<div style="float: left; width: 100%;"> <div class="clearfix"></div> <table id="dataTable" style="font-size: 12px;" data-toolbar="#timeSearch" data-toggle="table" data-locale="zh-CN" data-ajax="ajaxRequest" data-side-pagination="server" data-striped="true" data-click-to-select="true" data-sort-name="id" data-sort-order="desc" data-row-style="rowStyle" data-pagination="true" data-pagination-first-text="首页" data-pagination-pre-text="上一页" data-pagination-next-text="下一页" data-pagination-last-text="末页" data-show-jumpto="true"> <thead style="text-align: center;"> <tr> <th data-radio="true"></th> <th data-field="id" data-width="40" data-formatter="indexFormatter" data-halign="center" data-align="center">序号</th> <th data-field="code" data-sortable="true" data-formatter="codeFormatter" data-halign="center" data-width="280" data-align="center">编码</th> <th data-field="field1" data-halign="center" data-sortable="true" data-width="280" data-align="center">字段1</th> <th data-field="field2" data-halign="center" data-sortable="true" data-width="280" data-align="center">字段2</th> <th data-field="field3" data-halign="center" data-sortable="true" data-width="280" data-align="center">字段3</th> <th data-field="field4" data-halign="center" data-sortable="true" data-width="280" data-align="center">字段4</th> </tr> </thead> </table> </div>
更多Bootstrap相关技术文章,请访问Bootstrap教程栏目进行学习!
以上就是bootstraptable排序可以么的详细内容,更多请关注Gxl网其它相关文章!