<divclass="container"><divid="toolbar"><buttonid="remove"class="btnbtn-danger"disabled><iclass="glyphiconglyphicon-remove"></i>Delete</button></div><tableid="mytable"><thead><tr><thdata-field="rowid"data-checkbox="true"></th><thdata-field="Name"data-editable="true">部门名称</th><thdata-field="ParentName">上级部门</th><thdata-field="Level"data-editable="true">部门级别</th><thdata-field="Desc"data-editable="true">描述</th></tr></thead></table></div><linkrel="stylesheet"href="common/bootstrap-table/bootstrap-table.css"><linkrel="stylesheet"href="common/bootstrap-table/bootstrap-editable.css"><scripttype="text/javascript"src="common/bootstrap-table/bootstrap-table.js"></script><scripttype="text/javascript"src="common/bootstrap-table/bootstrap-editable.js"></script><scripttype="text/javascript"src="common/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>

<script>$('#mytable').bootstrapTable({url:'test_table',//请求后台的URL(*)dataField:"rows",//服务端返回数据键值就是说记录放的键值是rows,分页时使用总记录数的键值为totalcache:false,//是否使用缓存,默认为truesearch:true,//是否搜索pagination:true,//是否分页pageSize:5,//单页记录数pageNumber:1,//初始化加载第一页,默认第一页pageList:[5,10,20,50],//分页步进值sidePagination:"server",//分页方式:client客户端分页,server服务端分页paginationFirstText:"首页",paginationPreText:"上一页",paginationNextText:"下一页",paginationLastText:"末页",clickToSelect:true,//是否启用点击选中行dataType:"json",//期待返回数据类型method:"get",//请求方式searchAlign:"left",//查询框对齐方式locale:"zh-CN",//中文支持,detailView:true,//是否显示详情折叠detailFormatter:function(index,row,element){varhtml='';$.each(row,function(key,val){html+="<p>"+key+":"+val+"</p>"});returnhtml;},queryParamsType:"limit",//查询参数组织方式queryParams:functiongetParams(params){//自定义传递参数params.other="otherInfo";returnparams;},searchOnEnterKey:false,//回车搜索showRefresh:true,//刷新按钮showColumns:true,//列选择按钮buttonsAlign:"left",//按钮对齐方式toolbar:"#toolbar",//指定工具栏toolbarAlign:"right",//工具栏对齐方式columns:[{field:"rowid",title:"全选",checkbox:true,},{field:'Name',title:'部门名称',editable:true},{field:'ParentName',title:'上级部门'},{field:'Level',title:'部门级别'},{field:'Desc',title:'描述'},]});</script>