一、添加样式
1 <style>
2 .fixed-table-container thead th .sortable {
3 background-image: url('/Content/css/plugins/images/sort_sort.png');
4 cursor: pointer;
5 background-position: right;
6 background-repeat: no-repeat;
7 padding-right: 30px;
8 }
9
10 .fixed-table-container thead th .asc {
11 background-image: url('/Content/css/plugins/images/sort_asc.png');
12 cursor: pointer;
13 background-position: right;
14 background-repeat: no-repeat;
15 padding-right: 30px;
16 }
17
18 .fixed-table-container thead th .desc {
19 background-image: url('/Content/css/plugins/images/sort_desc.png');
20 cursor: pointer;
21 background-position: right;
22 background-repeat: no-repeat;
23 padding-right: 30px;
24 }
25 </style>
1 二、手动控制样式
2 $("#myTab2").on("click", "a", function () {
3 $("#sub_houseRank").val($(this).attr("data-pg"));
4 $("#sub_tabRefresh").val(1);
5
6 $("#sub_rentRank").val($(this).attr("data-pg"));
7 $table.handler.bootstrapTable('refreshOptions', { pageNumber: 1 });
8
9 if ($("thead th div").hasClass("desc")) {
10 $("thead th div").removeClass("desc");
11 }
12 if ($("thead th div").hasClass("asc")) {
13 $("thead th div").removeClass("asc");
14 }
15 });
16 //房源信息加载成功
17 $("#tb_commlist").on('load-success.bs.table', function (data) {
18 if ($("#sub_tabRefresh").val() == 1) {
19 $("thead th div").removeClass("desc").removeClass("asc");
20 }
21 $("#sub_tabRefresh").val(0);
22 });
三、配置bootstrapTable
四、后台接受排序参数