Is bootstraptable sorting possible?

(*-*)浩
Release: 2019-07-11 11:08:46
Original
3232 people have browsed it

How to sort the columns of BootstrapTable.

Is bootstraptable sorting possible?

First create a table, use ajax to query the data, and then sort all columns. Meet your own needs. (Recommended learning: Bootstrap video tutorial)

data-sortable="true", this attribute is added to the column to display up and down sorting arrows.

<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>
Copy after login

For more technical articles related to Bootstrap, please visit the Bootstrap Tutorial column to learn!

The above is the detailed content of Is bootstraptable sorting possible?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template