bootstrapTable函数


使用方法的语法:$('#table').bootstrapTable('method', parameter);

 
名称
参数
描述
例子
getOptionsnone返回表格的 Options。
getSelectionsnone返回所选的行,当没有选择任何行的时候返回一个空数组。
getAllSelectionsnone返回所有选择的行,包括搜索过滤前的,当没有选择任何行的时候返回一个空数组。
getDatauseCurrentPage或者当前加载的数据。假如设置 useCurrentPage 为 true,则返回当前页的数据。
getRowByUniqueIdid根据 uniqueId 获取行数据。
loaddata加载数据到表格中,旧数据会被替换。
showAllColumnsnoneShow All the columns.
hideAllColumnsnoneHide All the columns.
appenddata添加数据到表格在现有数据之后。
prependdata插入数据到表格在现有数据之前。
removeparams从表格中删除数据,包括两个参数: field: 需要删除的行的 field 名称。
values: 需要删除的行的值,类型为数组。
removeAll-删除表格所有数据。
removeByUniqueIdid根据 uniqueId 删除指定的行。
insertRowparams插入新行,参数包括:
index: 要插入的行的 index。
row: 行的数据,Object 对象。
updateRowparams更新指定的行,参数包括:
index: 要更新的行的 index。
row: 行的数据,Object 对象。
showRowparams显示指定的行,参数包括:
index: 要更新的行的 index 或者 uniqueId。
isIdField: 指定 index 是否为 uniqueid。
hideRowparams显示指定的行,参数包括:
index: 要更新的行的 index。
uniqueId: 或者要更新的行的 uniqueid。
getHiddenRowsshowGet all rows hidden and if you pass the show parameter true the rows will be shown again, otherwise, the method only will return the rows hidden.
mergeCellsoptionsMerge some cells to one cell, the options contains following properties: 
index: the row index. 
field: the field name.
rowspan: the rowspan count to be merged. 
colspan: the colspan count to be merged.
updateCellparamsUpdate one cell, the params contains following properties: 
index: the row index. 
field: the field name.
value: the new field value.
refreshparamsRefresh the remote server data, you can set {silent: true} to refresh the data silently, and set {url: newUrl} to change the url. To supply query params specific to this request, set {query: {foo: 'bar'}}
refreshOptionsoptionsRefresh the options
resetSearchtextSet the search text
showLoadingnoneShow loading status.
hideLoadingnoneHide loading status.
checkAllnoneCheck all current page rows.
uncheckAllnoneUncheck all current page rows.
checkindexCheck a row, the row index start with 0.
uncheckindexUncheck a row, the row index start with 0.
checkByparamsCheck a row by array of values, the params contains:
field: name of the field used to find records
values: array of values for rows to check
Example: 
$("#table").bootstrapTable("checkBy", {field:"field_name", values:["value1","value2","value3"]})
uncheckByparamsUncheck a row by array of values, the params contains:
field: name of the field used to find records
values: array of values for rows to uncheck
Example: 
$("#table").bootstrapTable("uncheckBy", {field:"field_name", values:["value1","value2","value3"]})
resetViewparamsReset the bootstrap table view, for example reset the table height.
resetWidthnoneResizes header and footer to fit current columns width
destroynoneDestroy the bootstrap table.
showColumnfieldShow the specified column.
hideColumnfieldHide the specified column.
getHiddenColumns-获取隐藏的列。
getVisibleColumns-获取可见列。
scrollTovalue滚动到指定位置,单位为 px,设置 'bottom' 表示跳到最后。
getScrollPositionnone获取当前滚动条的位置,单位为 px。
filterByparams(只能用于 client 端)过滤表格数据, 你可以通过过滤{age: 10}来显示 age 等于 10 的数据。
selectPagepage跳到指定的页。
prevPagenone跳到上一页。
nextPagenone跳到下一页。
togglePaginationnone切换分页选项。
toggleViewnone切换 card/table 视图
expandRowindexExpand the row that has the index passed by parameter if the detail view option is set to True.
collapseRowindexCollapse the row that has the index passed by parameter if the detail view option is set to True.
expandAllRowsis subtableExpand all rows if the detail view option is set to True.
collapseAllRowsis subtableCollapse all rows if the detail view option is set to True.

多语言Edit on GitHub


 
Name
Parameter
Default
formatLoadingMessage-'Loading, please wait…'
formatRecordsPerPagepageNumber'%s records per page'
formatShowingRowspageFrom, pageTo, totalRows'Showing %s to %s of %s rows'
formatDetailPaginationtotalRows'Showing %s rows'
formatSearch-'Search'
formatNoMatches-'No matching records found'
formatRefresh-'Refresh'
formatToggle-'Toggle'
formatColumns-'Columns'
formatAllRows-'All'


PS:

We can import all locale files what you need:

Copy
<script src="bootstrap-table-en-US.js"></script>
<script src="bootstrap-table-zh-CN.js"></script>
...

And then use JavaScript to switch locale:

Copy
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['en-US']);
// $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
// ...
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值