2017-01-19 34 views
0

我使用自舉表並有第一列的默認排序排序。 如何更改默認的列和選擇其他,並使用(升序/降序)自舉表默認

+0

歡迎SO,請參閱[MCVE](HTTP://小號tackoverflow.com/help/mcve) – bhansa

回答

-1

你應該尋找一下前問。關於這個的很多話題。這裏是最好的安娜Bootstrap - How to sort table columns。你可以運行代碼snipet來查看一個例子。

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/><link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.0/bootstrap-table.min.css" rel="stylesheet"/><table data-toggle="table" data-url="https://api.github.com/users/wenzhixin/repos?type=owner&sort=full_name&direction=asc&per_page=100&page=1" data-sort-name="stargazers_count" data-sort-order="desc"> <thead> <tr> <th data-field="name" data-sortable="true"> Name </th> <th data-field="stargazers_count" data-sortable="true"> Stars </th> <th data-field="forks_count" data-sortable="true"> Forks </th> <th data-field="description" data-sortable="true"> Description </th> </tr></thead></table><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.0/bootstrap-table.min.js"></script>