bootstrap Table's Parameter
来源:互联网 发布:白鲨外设淘宝店好 编辑:程序博客网 时间:2024/06/10 18:03
true
会有隔行变色效果sortNamedata-sort-nameStringundefined定义排序列,通过url方式获取数据填写字段名,否则填写下标sortOrderdata-sort-orderString'asc'定义排序方式 'asc' 或者 'desc'sortStabledata-sort-stableBooleanfalse设置为 true
将获得稳定的排序,我们会添加_position
属性到 row 数据中。iconsPrefixdata-icons-prefixString'glyphicon'定义字体库 ('Glyphicon' or 'fa' for FontAwesome),使用"fa"时需引用 FontAwesome,并且配合 icons 属性实现效果Glyphicon 集成于Bootstrap可免费使用 参考:http://glyphicons.com/
FontAwesome 参考:http://fortawesome.github.io/iconsdata-iconsObject{
paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down',
paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up',
refresh: 'glyphicon-refresh icon-refresh'
toggle: 'glyphicon-list-alt icon-list-alt'
columns: 'glyphicon-th icon-th'
detailOpen: 'glyphicon-plus icon-plus'
detailClose: 'glyphicon-minus icon-minus'
}自定义图标columns-Array[]列配置项,详情请查看 列参数 表格.data-Array[]加载json格式的数据ajaxdata-ajaxFunctionundefined自定义 AJAX 方法,须实现 jQuery AJAX APImethoddata-methodString'get'服务器数据的请求方式 'get' or 'post'urldata-urlStringundefined服务器数据的加载地址cachedata-cacheBooleantrue设置为
true
禁用 AJAX 数据缓存contentTypedata-content-typeString'application/json'发送到服务器的数据编码类型dataTypedata-data-typeString'json'服务器返回的数据类型ajaxOptionsdata-ajax-optionsObject{}提交ajax请求时的附加参数,可用参数列请查看http://api.jquery.com/jQuery.ajax.queryParamsdata-query-paramsFunctionfunction(params) {return params;
}请求服务器数据时,你可以通过重写参数的方式添加一些额外的参数,例如 toolbar 中的参数 如果 queryParamsType = 'limit' ,返回参数必须包含
limit, offset, search, sort, order 否则, 需要包含:
pageSize, pageNumber, searchText, sortName, sortOrder.
返回false将会终止请求queryParamsTypedata-query-params-typeString'limit'设置为 'limit' 则会发送符合 RESTFul 格式的参数.responseHandlerdata-response-handlerFunctionfunction(res) {
return res;
}加载服务器数据之前的处理程序,可以用来格式化数据。
参数:res为从服务器请求到的数据。paginationdata-paginationBooleanfalse设置为
true
会在表格底部显示分页条paginationLoopdata-pagination-loopBooleantrue设置为 true
启用分页条无限循环的功能。onlyInfoPaginationdata-only-info-paginationBooleanfalse设置为 true
只显示总数据数,而不显示分页按钮。需要 pagination='True'sidePaginationdata-side-paginationString'client'设置在哪里进行分页,可选值为 'client' 或者 'server'。设置 'server'时,必须设置 服务器数据地址(url)或者重写ajax方法pageNumberdata-page-numberNumber1如果设置了分页,首页页码pageSizedata-page-sizeNumber10如果设置了分页,页面数据条数pageListdata-page-listArray[10, 25, 50, 100, All]如果设置了分页,设置可供选择的页面数据条数。设置为All 则显示所有记录。selectItemNamedata-select-item-nameString'btSelectItem'radio or checkbox 的字段名smartDisplaydata-smart-displayBooleantrueTrue to display pagination or card view smartly.escapedata-escapeBooleanfalse转义HTML字符串,替换 &
, <
, >
, "
, `
, 和 '
字符.searchdata-searchBooleanfalse是否启用搜索框searchOnEnterKeydata-search-on-enter-keyBooleanfalse设置为 true
时,按回车触发搜索方法,否则自动触发搜索方法strictSearchdata-strict-searchBooleanfalse设置为 true
启用 全匹配搜索,否则为模糊搜索searchTextdata-search-textString''初始化搜索文字searchTimeOutdata-search-time-outNumber500设置搜索超时时间trimOnSearchdata-trim-on-searchBooleantrue设置为 true
将允许空字符搜索showHeaderdata-show-headerBooleantrue是否显示列头showFooterdata-show-footerBooleanfalse是否显示列脚showColumnsdata-show-columnsBooleanfalse是否显示 内容列下拉框showRefreshdata-show-refreshBooleanfalse是否显示 刷新按钮showToggledata-show-toggleBooleanfalse是否显示 切换试图(table/card)按钮showPaginationSwitchdata-show-pagination-switchBooleanfalse是否显示 数据条数选择框minimumCountColumnsdata-minimum-count-columnsNumber1当列数小于此值时,将隐藏内容列下拉框。idFielddata-id-fieldStringundefined指定主键列uniqueIddata-unique-idStringundefinedIndicate an unique identifier for each row.cardViewdata-card-viewBooleanfalse设置为 true
将显示card视图,适用于移动设备。否则为table试图,适用于pcdetailViewdata-detail-viewBooleanfalse设置为 true
可以显示详细页面模式。detailFormatterdata-detail-formatterFunctionfunction(index, row) {return '';
}格式化详细页面模式的视图。searchAligndata-search-alignString'right'指定 搜索框 水平方向的位置。'left' or 'right'buttonsAligndata-buttons-alignString'right'指定 按钮 水平方向的位置。'left' or 'right'toolbarAligndata-toolbar-alignString'left'指定 toolbar 水平方向的位置。'left' or 'right'paginationVAligndata-pagination-v-alignString'bottom'指定 分页条 在垂直方向的位置。'top' or 'bottom' or 'bonth'paginationHAligndata-pagination-h-alignString'right'指定 分页条 在水平方向的位置。'left' or 'right'paginationDetailHAligndata-pagination-detail-h-alignString'left'指定 分页详细信息 在水平方向的位置。'left' or 'right'paginationPreTextdata-pagination-pre-textString'<'指定分页条中上一页按钮的图标或文字paginationNextTextdata-pagination-next-textString'>'指定分页条中下一页按钮的图标或文字clickToSelectdata-click-to-selectBooleanfalse设置true 将在点击行时,自动选择rediobox 和 checkboxsingleSelectdata-single-selectBooleanfalse设置True 将禁止多选toolbardata-toolbarStringundefined一个jQuery 选择器,指明自定义的toolbar 例如:
#toolbar, .toolbar.checkboxHeaderdata-checkbox-headerBooleantrue设置false 将在列头隐藏check-all checkbox .maintainSelecteddata-maintain-selectedBooleanfalse设置为
true
在点击分页按钮或搜索按钮时,将记住checkbox的选择项sortabledata-sortableBooleantrue设置为false
将禁止所有列的排序silentSortdata-silent-sortBooleantrue设置为 false
将在点击分页按钮时,自动记住排序项。仅在 sidePagination设置为 server
时生效.rowStyledata-row-styleFunctionfunction(row,index) {return class;
}自定义行样式 参数为:
row: 行数据
index: 行下标
返回值可以为class或者cssrowAttributesdata-row-attributesFunctionfunction(row,index) {
return attributes;
}自定义行属性 参数为:
row: 行数据
index: 行下标
返回值可以为class或者css 支持所有自定义属性customSearchdata-custom-searchFunction$.noopThe custom search function is executed instead of built-in search function, takes one parameters:
text: the search text.
Example usage:
function customSearch(text) { //Search logic here. //You must use `this.data` array in order to filter the data. NO use `this.options.data`. }customSortdata-custom-sortFunction$.noopThe custom sort function is executed instead of built-in sort function, takes two parameters:
sortName: the sort name.
sortOrder: the sort order.
Example usage:
function customSort(sortName, sortOrder) { //Sort logic here. //You must use `this.data` array in order to sort the data. NO use `this.options.data`. }
The cell formatter function, take three parameters:
value: the field value.
row: the row record data.
index: the row index.footerFormatterdata-footer-formatterFunctionundefinedThe context (this) is the column Object.
The function, take one parameter:
data: Array of all the data rows.
the function should return a string with the text to show in the footer cell.eventsdata-eventsObjectundefinedThe cell events listener when you use formatter function, take three parameters:
event: the jQuery event.
value: the field value.
row: the row record data.
index: the row index.sorterdata-sorterFunctionundefinedThe custom field sort function that used to do local sorting, take two parameters:
a: the first field value.
b: the second field value.sortNamedata-sort-nameStringundefinedProvide a customizable sort-name, not the default sort-name in the header, or the field name of the column. For example, a column might display the value of fieldName of "html" such as "<b><span style="color:red">abc</span></b>", but a fieldName to sort is "content" with the value of "abc".cellStyledata-cell-styleFunctionundefinedThe cell style formatter function, take three parameters:
value: the field value.
row: the row record data.
index: the row index.
field: the row field.
Support classes or css.searchabledata-searchableBooleantrueTrue to search data for this column.searchFormatterdata-search-formatterBooleantrueTrue to search use formated data.
name:事件名,
args:事件的参数。onClickRowclick-row.bs.tablerow, $element当用户点击某一行的时候触发,参数包括:
row:点击行的数据,
$element:tr 元素,
field:点击列的 field 名称。onDblClickRowdbl-click-row.bs.tablerow, $element当用户双击某一行的时候触发,参数包括:
row:点击行的数据,
$element:tr 元素,
field:点击列的 field 名称。onClickCellclick-cell.bs.tablefield, value, row, $element当用户点击某一列的时候触发,参数包括:
field:点击列的 field 名称,
value:点击列的 value 值,
row:点击列的整行数据,
$element:td 元素。onDblClickCelldbl-click-cell.bs.tablefield, value, row, $element当用户双击某一列的时候触发,参数包括:
field:点击列的 field 名称,
value:点击列的 value 值,
row:点击列的整行数据,
$element:td 元素。onSortsort.bs.tablename, orderFires when user sort a column, the parameters contains:
name: the sort column field name
order: the sort column order.onCheckcheck.bs.tablerowFires when user check a row, the parameters contains:
row: the record corresponding to the clicked row. $element: the DOM element checked.onUncheckuncheck.bs.tablerowFires when user uncheck a row, the parameters contains:
row: the record corresponding to the clicked row. $element: the DOM element unchecked.onCheckAllcheck-all.bs.tablerowsFires when user check all rows, the parameters contains:
rows: array of records corresponding to newly checked rows.onUncheckAlluncheck-all.bs.tablerowsFires when user uncheck all rows, the parameters contains:
rows: array of records corresponding to previously checked rows.onCheckSomecheck-some.bs.tablerowsFires when user check some rows, the parameters contains:
rows: array of records corresponding to previously checked rows.onUncheckSomeuncheck-some.bs.tablerowsFires when user uncheck some rows, the parameters contains:
rows: array of records corresponding to previously checked rows.onLoadSuccessload-success.bs.tabledataFires when remote data is loaded successfully.onLoadErrorload-error.bs.tablestatusFires when some errors occur to load remote data.onColumnSwitchcolumn-switch.bs.tablefield, checkedFires when switch the column visible.onColumnSearchcolumn-search.bs.tablefield, textFires when search by column.onPageChangepage-change.bs.tablenumber, sizeFires when change the page number or page size.onSearchsearch.bs.tabletextFires when search the table.onToggletoggle.bs.tablecardViewFires when toggle the view of table.onPreBodypre-body.bs.tabledataFires before the table body is renderedonPostBodypost-body.bs.tablenoneFires after the table body is rendered and available in the DOMonPostHeaderpost-header.bs.tablenoneFires after the table header is rendered and availble in the DOMonExpandRowexpand-row.bs.tableindex, row, $detail当点击详细图标展开详细页面的时候触发。onCollapseRowcollapse-row.bs.tableindex, row当点击详细图片收起详细页面的时候触发。onRefreshOptionsrefresh-options.bs.tableoptionsFires after refresh the options and before destroy and init the table.onRefreshrefresh.bs.tableparamsFires after the click the refresh button.
使用方法的语法:$('#table').bootstrapTable('method', parameter);
。
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。getRowsHiddenshowGet 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 optionsresetSearchtextSet the search textshowLoadingnoneShow 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 widthdestroynoneDestroy 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. 0 0
- bootstrap Table's Parameter
- BootStrap -- Table
- Bootstrap Table
- bootstrap--table
- Bootstrap table
- bootstrap-table
- bootstrap table
- Bootstrap Table
- bootstrap table
- bootstrap table
- bootstrap table
- bootstrap table
- cl parameter table
- Bootstrap表格插件--bootstrap-table
- bootstrap-table(一)
- bootstrap-table(二)
- bootstrap-table(三)
- bootstrap table 服务端
- android之蓝牙通信(二)(蓝牙连接,数据传递)
- 【AI每日播报】意念控制特斯拉 AI看漫画
- 了解HHOOK之路( 二 )
- [webAPP项目]基于MUI框架开发APP功能点开发详解大纲
- Linux中的update和upgrade的作用
- bootstrap Table's Parameter
- 第十一周 项目一-验证算法(2)
- 启程
- centos6.5设定IP
- 第十一周项目1验证算法—(4)哈夫曼编码的算法验证
- java算法3~翻转字符串
- 1034. Head of a Gang (30) (并查集 & map)
- ADS1.2裸板调试mini2440串口 (含源码)
- 在查询分析器中执行update更新一个字段查询一直执行但不会成功