bootstrap table操作技巧
来源:互联网 发布:网络彩票开售最新消息 编辑:程序博客网 时间:2024/05/16 13:40
相关资料
http://blog.csdn.net/daniel_lixuan/article/details/53197618
http://bootstrap-table.wenzhixin.net.cn/documentation/
https://github.com/wenzhixin/bootstrap-table/
ptions:Object
proto:Object
async:false
buttonsAlign:”right”
cache:false
cardView:false
checkboxHeader:true
classes:”table table-hover”
clickToSelect:false
columns:Array(1)
contentType:”application/json”
data:Array(146)
dataField:”rows”
dataType:”json”
detailFormatter:function (index, row)
detailView:false
editable:Editable
exportDataType:”all”
exportOptions:Object
exportTypes:Array(6)
formatAllRows:function ()
formatColumns:function ()
formatDetailPagination:function (totalRows)
formatLoadingMessage:function ()
formatNoMatches:function ()
formatPaginationSwitch:function ()
formatRecordsPerPage:function (pageNumber)
formatRefresh:function ()
formatSearch:function ()
formatShowingRows:function (pageFrom, pageTo, totalRows)
formatToggle:function ()
icons:Object
iconsPrefix:”glyphicon”
maintainSelected:false
method:”get”
minimumCountColumns:1
onAll:function (name, args)
onCheck:function (row)
onCheckAll:function (rows)
onCheckSome:function (rows)
onClickCell:function (field, value, row,
onCollapseRow:function (index, row)
onColumnSwitch:function (field, checked)
onDblClickCell:function (field, value, row,
onEditableHidden:function (field, row,
onEditableShown:function (field, row,
onLoadError:function (status)
onLoadSuccess:function (data)
onPageChange:function (number, size)
onPostBody:function ()
onPostHeader:function ()
onPreBody:function (data)
onRefreshOptions:function (options)
onResetView:function ()
onSearch:function (text)
onSort:function (name, order)
onToggle:function (cardView)
onUncheck:function (row)
onUncheckAll:function (rows)
onUncheckSome:function (rows)
oneditablesave:”my2_onEditableSave”
onlyInfoPagination:false
pageList:Array(4)
pageNumber:1
pageSize:50
pagination:true
paginationDetailHAlign:”left”
paginationFirstText:”首页”
paginationHAlign:”right”
paginationLastText:”末页”
paginationNextText:”下一页”
paginationPreText:”上一页”
paginationVAlign:”bottom”
queryParams:function (params)
queryParamsType:”limit”
responseHandler:function (res)
rowAttributes:function (row, index)
rowStyle:function (row, index)
search:true
searchAlign:”right”
searchText:””
searchTimeOut:500
selectItemName:”btSelectItem”
showColumns:true
showExport:true
showFooter:false
showHeader:true
showPaginationSwitch:false
showRefresh:true
showToggle:false
sidePagination:”client”
silentSort:true
singleSelect:false
smartDisplay:true
sortName:”seq”
sortOrder:”asc”
sortable:true
strictSearch:false
striped:false
toggle:”table”
toolbarAlign:”left”
totalPages:3
totalRows:146
trimOnSearch:true
undefinedText:”-“
源码
html代码
<table id="agenttable" data-toggle="table" data-pagination="true" data-cache="false" data-height="800" data-show-columns="true" data-smart-display = "true" data-async = false data-query-params="bh_agt_queryParams" data-search="true" data-sortable="true" data-show-export="true" data-show-refresh="true" data-page-size="15" data-page-list="[15,30,60,120]" data-response-handler="bh_agt_bootstrapresp" data-row-style="table_rowFormatter" > <thead> <tr> <th data-field="id" data-align="center" data-sortable="true" bgcolor="#FF0000">id</th> <th data-field="name" data-align="center" data-sortable="true">名称</th> <th data-field="agentip" data-align="center" data-sortable="true">ip</th> <th data-field="country" data-align="center" data-sortable="true">国家</th> <th data-field="province" data-align="center" data-sortable="true">省</th> <th data-field="city" data-align="center" data-sortable="true">市</th> <th data-field="carrier" data-align="center" data-sortable="true">提供商</th> </tr> </thead></table>
js代码:
//生成后台数据请求参数。后台可以用request.getParameter获取var bh_agt_queryParams=function(params){ var tmp = bt_bhagent_paras//外面生成的json格式参数 bt_bhagent_paras={} return tmp}var bh_agt_bootstrapresp=function(data){ bt_bhagent_list = data; //这里是动态加载数据后的入口函数。 //在这里可以对data进行二次加工生成retdata。 //在这里也可以出发其它的关联动作,比如说画echart图。 return retdata}//对单行数据进行格式化,可以返回各种cssvar table_rowFormatter = function(row, index){ if (row.succ == "SUCCESS"){ return { classes: 'success' }; }else if (row.succ == "NOTING"){ return { classes: 'warning' }; } return { classes: 'danger' };}//加载Table数据var bh_table_update = function(refresh,filter){ if (refresh){ $('#'+ filter.eTable).bootstrapTable('refresh',{ url: filter.tableUrl }); }else{ $('#'+ filter.eTable).bootstrapTable({ url: filter.tableUrl }); }}
知识点说明
- bootstrapTable(‘refresh’,{ url: filter.tableUrl}); 的方式在第一次加载数据时会失败。第一次加载数据不能带refresh动作。
- 在非第一次加载数据时,必须执行refresh动作,否则数据不会更新到表中。
- 如果向直接加载已有数据,则需要使用load动作。如:bootstrapTable(“load”,data);
- .bootstrapTable(‘mergeCells’, {index: 0,field: ‘name’,rowspan: 3}); 可以实现行或列的合并
- 在refresh等动作中,设置silent: true参数,则不会提示 wait loading。
- bootstrap table操作技巧
- bootstrap-table操作使用
- bootstrap table的常用操作
- bootstrap table 中自定义新增操作
- BootStrap -- Table
- Bootstrap Table
- bootstrap--table
- Bootstrap table
- bootstrap-table
- bootstrap table
- Bootstrap Table
- bootstrap table
- bootstrap table
- bootstrap table
- bootstrap table
- Bootstrap Table使用整理(六)-常用操作
- Bootstrap Table使用整理(六)-常用操作
- bootstrap table 中自定义修改和删除操作
- Android 强制且彻底的退出app
- 如何给CentOS 安装Vmware Tools
- 瓦片地图服务参数与计算
- zookeeper-会话
- 依赖ConstraintLayout报错:Could not find com.android.support.constraint:constraint-layout:1.0.0-beta5
- bootstrap table操作技巧
- 【转】冲突域与广播域
- bzoj 1485: [HNOI2009]有趣的数列 (卡特兰数)
- Vuex原来可以这样上手
- 归并排序
- IOS angular ng-click ng-touch 手机延时问题,fastclick
- android 常用网址(持续更新)
- Android 7.0 AsyncTask分析
- zookeeper-客户端