bootstraptable 超多列_Bootstrap Table

AJAX:

Use url, method, cache, contentType, dataType, queryParams, queryParamsType, responseHandler options to set the AJAX request and response params.

基本表格

不通过JavaScript的方式启动Bootstrap Table(使用data-toggle="table")。

Item IDItem NameItem Price

Item IDItem NameItem Price

0Item 0$0

1Item 1$1

2Item 2$2

3Item 3$3

4Item 4$4

5Item 5$5

6Item 6$6

7Item 7$7

8Item 8$8

9Item 9$9

10Item 10$10

11Item 11$11

12Item 12$12

13Item 13$13

14Item 14$14

15Item 15$15

16Item 16$16

17Item 17$17

18Item 18$18

19Item 19$19

20Item 20$20

Item IDItem NameItem Price

表格转换

从已经存在、未被格式化的表格中转换为Bootstrap Table。

Item ID

Item Name

Item Price

1

Item 1

$1

2

Item 2

$2

3

Item 3

$3

4

Item 4

$4

5

Item 5

$5

Transform

Destroy

Item IDItem NameItem Price

1Item 1$12Item 2$23Item 3$34Item 4$45Item 5$5

$(function () {

var $table = $('#table-transform');

$('#transform').click(function () {

$table.bootstrapTable();

});

$('#destroy').click(function () {

$table.bootstrapTable('destroy');

});

});

表格样式

用height, classes, striped, rowStyle 属性和class, width, cellStyle 列属性设置 bootstrap table 的样式。

hover

striped

condensed

Item ID

Item Name

Item Price

hover

striped

condensed

Item ID

Item Name

Item Price

$(function () {

$('#hover, #striped, #condensed').click(function () {

var classes = 'table';

if ($('#hover').prop('checked')) {

classes += ' table-hover';

}

if ($('#condensed').prop('checked')) {

classes += ' table-condensed';

}

$('#table-style').bootstrapTable('destroy')

.bootstrapTable({

classes: classes,

striped: $('#striped').prop('checked')

});

});

});

function rowStyle(row, index) {

var classes = ['active', 'success', 'info', 'warning', 'danger'];

if (index % 2 === 0 && index / 2 < classes.length) {

return {

classes: classes[index / 2]

};

}

return {};

}

列对齐

使用 align, halign 和 valign 来设置列和表头的对齐方式。

Item ID

Item Name

Item Price

Item IDItem NameItem Price

表格排序

基本排序

使用 sortName, sortOrder, sortable 属性和 sortable, order 列属性去设置表格的基本排序。

Item ID

Item Name

Item Price

Item IDItem NameItem Price

自定义排序

使用 sorter列属性来定义表格的自定义排序。

Item ID

Item Name

Item Price

Item IDItem NameItem Price

function priceSorter(a, b) {

a = +a.substring(1); // remove $

b = +b.substring(1);

if (a > b) return 1;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值