bootstrap table

1、导入js与css

<!--导入js的方式有很多,按你们自己的来  我这里是用了thymeleaf模板-->
<link th:href="@{/static/bootstrap/dist/css/bootstrap.min.css}" rel="stylesheet">
<link th:href="@{/static/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet">

<!-- Jquery-->
<script th:src="@{/static/jquery/jquery.min.js}"></script>
<!-- bootstrap-->
<script th:src="@{/static/bootstrap/dist/js/bootstrap.min.js}"></script>
<!-- bootstrap table -->
<script th:src="@{/static/bootstrap-table/bootstrap-table.min.js}"></script>
<script th:src="@{/static/bootstrap-table/bootstrap-table-zh-CN.js}"></script>

 2、js代码如下

    $('#table').bootstrapTable('destroy'); 
    $('#table').bootstrapTable({
	method : 'post',
    //get方法使用默认的application/json
	contentType : 'application/x-www-form-urlencoded',	
	url : '', // 路径
	queryParams : function(parms){ // 参数
        var parm = {
                // name : name
        }
        return parm
    },
	dataType: 'json',			// 返回数据类型
	locale:'zh-CN',				// 中文支持
	showRefresh: false,			// 刷新按钮
	showColumns: false,			// 显示列筛选
	//sidePagination: 'server',	// 设置在哪里进行分页,可选值为 'client' 或者 'server'
	uniqueId : '', 				// 绑定ID,对每一行指定唯一标识符
	cache : false, 				// 设置为 false,禁用 AJAX 数据缓存, 默认为true
	striped : false, 			// 表格显示条纹,默认为false
	pagination : true, 			// 在表格底部显示分页组件,默认false
	paginationLoop : true,		// 默认true,启用分页条无限循环的功能
	pageList : [ 20, 30, 40, 50 ],	// 设置页面可以显示的数据条数
	pageSize : 20, 				// 页面默认数据条数
	pageNumber : 1, 			// 首页页码
	search : false,				// 启动搜索框
	searchOnEnterKey : false,	// 默认false,输入自动搜索
	showHeader : true,			// 默认true
	showFooter : false,			// 默认false
	clickToSelect: false,		// 为true时点击行选中复选框
	toolbar : '',
    //showToggle:true,
	columns : [
		{ field : 'id', width : 100, align: 'center', title : 'id' },
		{ field : 'name', width : 100, align: 'center', title : '名称' },
		{ field : 'age', width : 150, align: 'center', title : '年龄' },
		{ field : 'six', width : 100, align: 'center', title : '性别' }
	],
	onLoadSuccess : function(data) {
		// 加载成功之后  
	}
});

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

cocosum

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值