BootstrapTable中文文档
生活随笔
收集整理的這篇文章主要介紹了
BootstrapTable中文文档
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
表格參數(shù):
| - | data-toggle | String | ‘table’ | 不用寫(xiě) JavaScript 直接啟用表格。 |
| classes | data-classes | String | ‘table table-hover’ | 表格的類(lèi)名稱(chēng)。默認(rèn)情況下,表格是有邊框的,你可以添加 ‘table-no-bordered’ 來(lái)刪除表格的邊框樣式。 |
| sortClass | data-sort-class | String | undefined | 被排序的td標(biāo)簽的class名 |
| height | data-height | Number | undefined | 定義表格的高度。 |
| undefinedText | data-undefined-text | String | ‘-‘ | 當(dāng)數(shù)據(jù)為 undefined 時(shí)顯示的字符 |
| striped | data-striped | Boolean | false | 設(shè)置為?true?會(huì)有隔行變色效果 |
| sortName | data-sort-name | String | undefined | 定義排序列,通過(guò)url方式獲取數(shù)據(jù)填寫(xiě)字段名,否則填寫(xiě)下標(biāo) |
| sortOrder | data-sort-order | String | ‘a(chǎn)sc’ | 定義排序方式 ‘a(chǎn)sc’ 或者 ‘desc’ |
| sortStable | data-sort-stable | Boolean | false | 設(shè)置為?true?將獲得穩(wěn)定的排序,我們會(huì)添加_position屬性到 row 數(shù)據(jù)中。 |
| iconsPrefix | data-icons-prefix | String | ‘glyphicon’ | 定義字體庫(kù) (‘Glyphicon’ or ‘fa’ for FontAwesome),使用”fa”時(shí)需引用 FontAwesome,并且配合 icons 屬性實(shí)現(xiàn)效果 Glyphicon 集成于Bootstrap可免費(fèi)使用 參考:http://glyphicons.com/ FontAwesome 參考:http://fortawesome.github.io/ |
| icons | data-icons | Object | { 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’ } | 自定義圖標(biāo) |
| columns | - | Array | [] | 列配置項(xiàng),詳情請(qǐng)查看 列參數(shù) 表格. |
| data | - | Array | [] | 加載json格式的數(shù)據(jù) |
| ajax | data-ajax | Function | undefined | 自定義 AJAX 方法,須實(shí)現(xiàn) jQuery AJAX API |
| method | data-method | String | ‘get’ | 服務(wù)器數(shù)據(jù)的請(qǐng)求方式 ‘get’ or ‘post’ |
| url | data-url | String | undefined | 服務(wù)器數(shù)據(jù)的加載地址 |
| cache | data-cache | Boolean | true | 設(shè)置為?true?禁用 AJAX 數(shù)據(jù)緩存 |
| contentType | data-content-type | String | ‘a(chǎn)pplication/json’ | 發(fā)送到服務(wù)器的數(shù)據(jù)編碼類(lèi)型 |
| dataType | data-data-type | String | ‘json’ | 服務(wù)器返回的數(shù)據(jù)類(lèi)型 |
| ajaxOptions | data-ajax-options | Object | {} | 提交ajax請(qǐng)求時(shí)的附加參數(shù),可用參數(shù)列請(qǐng)查看http://api.jquery.com/jQuery.ajax. |
| queryParams | data-query-params | Function | function(params) { return params; } | 請(qǐng)求服務(wù)器數(shù)據(jù)時(shí),你可以通過(guò)重寫(xiě)參數(shù)的方式添加一些額外的參數(shù),例如 toolbar 中的參數(shù) 如果 queryParamsType = ‘limit’ ,返回參數(shù)必須包含 limit, offset, search, sort, order 否則, 需要包含:? pageSize, pageNumber, searchText, sortName, sortOrder.? 返回false將會(huì)終止請(qǐng)求 |
| queryParamsType | data-query-params-type | String | ‘limit’ | 設(shè)置為 ‘limit’ 則會(huì)發(fā)送符合 RESTFul 格式的參數(shù). |
| responseHandler | data-response-handler | Function | function(res) { return res; } | 加載服務(wù)器數(shù)據(jù)之前的處理程序,可以用來(lái)格式化數(shù)據(jù)。 參數(shù):res為從服務(wù)器請(qǐng)求到的數(shù)據(jù)。 |
| pagination | data-pagination | Boolean | false | 設(shè)置為?true?會(huì)在表格底部顯示分頁(yè)條 |
| paginationLoop | data-pagination-loop | Boolean | true | 設(shè)置為?true?啟用分頁(yè)條無(wú)限循環(huán)的功能。 |
| onlyInfoPagination | data-only-info-pagination | Boolean | false | 設(shè)置為?true?只顯示總數(shù)據(jù)數(shù),而不顯示分頁(yè)按鈕。需要 pagination=’True’ |
| sidePagination | data-side-pagination | String | ‘client’ | 設(shè)置在哪里進(jìn)行分頁(yè),可選值為 ‘client’ 或者 ‘server’。設(shè)置 ‘server’時(shí),必須設(shè)置 服務(wù)器數(shù)據(jù)地址(url)或者重寫(xiě)ajax方法 |
| pageNumber | data-page-number | Number | 1 | 如果設(shè)置了分頁(yè),首頁(yè)頁(yè)碼 |
| pageSize | data-page-size | Number | 10 | 如果設(shè)置了分頁(yè),頁(yè)面數(shù)據(jù)條數(shù) |
| pageList | data-page-list | Array | [10, 25, 50, 100, All] | 如果設(shè)置了分頁(yè),設(shè)置可供選擇的頁(yè)面數(shù)據(jù)條數(shù)。設(shè)置為All 則顯示所有記錄。 |
| selectItemName | data-select-item-name | String | ‘btSelectItem’ | radio or checkbox 的字段名 |
| smartDisplay | data-smart-display | Boolean | true | 設(shè)置為?true可以在分頁(yè)和卡片視圖快速切換 |
| escape | data-escape | Boolean | false | 轉(zhuǎn)義HTML字符串,替換?&,?<,?>,?",?`, 和?'字符. |
| search | data-search | Boolean | false | 是否啟用搜索框 |
| searchOnEnterKey | data-search-on-enter-key | Boolean | false | 設(shè)置為?true時(shí),按回車(chē)觸發(fā)搜索方法,否則自動(dòng)觸發(fā)搜索方法 |
| strictSearch | data-strict-search | Boolean | false | 設(shè)置為?true啟用 全匹配搜索,否則為模糊搜索 |
| searchText | data-search-text | String | ” | 初始化搜索文字 |
| searchTimeOut | data-search-time-out | Number | 500 | 設(shè)置搜索超時(shí)時(shí)間 |
| trimOnSearch | data-trim-on-search | Boolean | true | 設(shè)置為?true?將允許空字符搜索 |
| showHeader | data-show-header | Boolean | true | 是否顯示列頭 |
| showFooter | data-show-footer | Boolean | false | 是否顯示列腳 |
| showColumns | data-show-columns | Boolean | false | 是否顯示 內(nèi)容列下拉框 |
| showRefresh | data-show-refresh | Boolean | false | 是否顯示 刷新按鈕 |
| showToggle | data-show-toggle | Boolean | false | 是否顯示 切換試圖(table/card)按鈕 |
| showPaginationSwitch | data-show-pagination-switch | Boolean | false | 是否顯示 數(shù)據(jù)條數(shù)選擇框 |
| minimumCountColumns | data-minimum-count-columns | Number | 1 | 當(dāng)列數(shù)小于此值時(shí),將隱藏內(nèi)容列下拉框。 |
| idField | data-id-field | String | undefined | 指定主鍵列 |
| uniqueId | data-unique-id | String | undefined | 為每一行指定唯一的標(biāo)識(shí)符 |
| cardView | data-card-view | Boolean | false | 設(shè)置為?true將顯示card視圖,適用于移動(dòng)設(shè)備。否則為table試圖,適用于pc |
| detailView | data-detail-view | Boolean | false | 設(shè)置為?true?可以顯示詳細(xì)頁(yè)面模式。 |
| detailFormatter | data-detail-formatter | Function | function(index, row) { return ”; } | 格式化詳細(xì)頁(yè)面模式的視圖。 |
| searchAlign | data-search-align | String | ‘right’ | 指定 搜索框 水平方向的位置。’left’ or ‘right’ |
| buttonsAlign | data-buttons-align | String | ‘right’ | 指定 按鈕 水平方向的位置。’left’ or ‘right’ |
| toolbarAlign | data-toolbar-align | String | ‘left’ | 指定 toolbar 水平方向的位置。’left’ or ‘right’ |
| paginationVAlign | data-pagination-v-align | String | ‘bottom’ | 指定 分頁(yè)條 在垂直方向的位置。’top’ or ‘bottom’ or ‘bonth’ |
| paginationHAlign | data-pagination-h-align | String | ‘right’ | 指定 分頁(yè)條 在水平方向的位置。’left’ or ‘right’ |
| paginationDetailHAlign | data-pagination-detail-h-align | String | ‘left’ | 指定 分頁(yè)詳細(xì)信息 在水平方向的位置。’left’ or ‘right’ |
| paginationPreText | data-pagination-pre-text | String | ‘<’ | 指定分頁(yè)條中上一頁(yè)按鈕的圖標(biāo)或文字 |
| paginationNextText | data-pagination-next-text | String | ‘>’ | 指定分頁(yè)條中下一頁(yè)按鈕的圖標(biāo)或文字 |
| clickToSelect | data-click-to-select | Boolean | false | 設(shè)置true 將在點(diǎn)擊行時(shí),自動(dòng)選擇rediobox 和 checkbox |
| singleSelect | data-single-select | Boolean | false | 設(shè)置True 將禁止多選 |
| toolbar | data-toolbar | String | undefined | 一個(gè)jQuery 選擇器,指明自定義的toolbar 例如: #toolbar, .toolbar. |
| checkboxHeader | data-checkbox-header | Boolean | true | 設(shè)置false 將在列頭隱藏check-all checkbox . |
| maintainSelected | data-maintain-selected | Boolean | false | 設(shè)置為?true?在點(diǎn)擊分頁(yè)按鈕或搜索按鈕時(shí),將記住checkbox的選擇項(xiàng) |
| sortable | data-sortable | Boolean | true | 設(shè)置為false?將禁止所有列的排序 |
| silentSort | data-silent-sort | Boolean | true | 設(shè)置為?false?將在點(diǎn)擊分頁(yè)按鈕時(shí),自動(dòng)記住排序項(xiàng)。僅在 sidePagination設(shè)置為?server時(shí)生效. |
| rowStyle | data-row-style | Function | function(row,index) { return class; } | 自定義行樣式 參數(shù)為: row: 行數(shù)據(jù) index: 行下標(biāo) 返回值可以為class或者css |
| rowAttributes | data-row-attributes | Function | function(row,index) { return attributes; } | 自定義行屬性 參數(shù)為: row: 行數(shù)據(jù) index: 行下標(biāo) 返回值可以為class或者css 支持所有自定義屬性 |
| customSearch | data-custom-search | Function | $.noop | 執(zhí)行自定義搜索功能而不是內(nèi)置搜索功能,需要一個(gè)參數(shù): text: 搜索文本 如: function customSearch(text) {//Search logic here.//You must use `this.data` array in order to filter the data. NO use `this.options.data`.} |
| customSort | data-custom-sort | Function | $.noop | 執(zhí)行自定義排序函數(shù)而不是內(nèi)置排序函數(shù),需要兩個(gè)參數(shù):? sortName: 排序名稱(chēng) sortOrder: 排序順序 如: function customSort(sortName, sortOrder) {//Sort logic here.//You must use `this.data` array in order to sort the data. NO use `this.options.data`.} |
列參數(shù):
| radio | data-radio | Boolean | false | 是否顯示單選radio |
| checkbox | data-checkbox | Boolean | false | 是否顯示多選checkbox |
| field | data-field | String | undefined | 該列映射的data的參數(shù)名 |
| title | data-title | String | undefined | 該列的表頭名 |
| titleTooltip | data-title-tooltip | String | undefined | 該列表頭的title提示文本 |
| class | class / data-class | String | undefined | 該列的class |
| rowspan | rowspan / data-rowspan | Number | undefined | 合并單元格時(shí)定義合并多少行 |
| colspan | colspan / data-colspan | Number | undefined | 合并單元格時(shí)定義合并多少列 |
| align | data-align | String | undefined | 設(shè)置該列數(shù)據(jù)如何對(duì)齊,’left’, ‘right’, ‘center’ |
| halign | data-halign | String | undefined | table header對(duì)齊方式, ‘left’, ‘right’, ‘center’ |
| falign | data-falign | String | undefined | table footer對(duì)齊方式, ‘left’, ‘right’, ‘center’ |
| valign | data-valign | String | undefined | 單元格(cell)對(duì)齊方式. ‘top’, ‘middle’, ‘bottom’ |
| width | data-width | Number {Pixels or Percentage} | undefined | 列的寬度,可以使用像素或者百分比,不帶單位則默認(rèn)為px |
| sortable | data-sortable | Boolean | false | 該列是否排序(表頭顯示雙箭頭) |
| order | data-order | String | ‘a(chǎn)sc’ | 該列默認(rèn)的排序方式, ‘a(chǎn)sc’ or ‘desc’. |
| visible | data-visible | Boolean | true | 該列是否可見(jiàn) |
| cardVisible | data-card-visible | Boolean | true | 在card視圖里是否可見(jiàn) |
| switchable | data-switchable | Boolean | true | 列切換是否可見(jiàn). |
| clickToSelect | data-click-to-select | Boolean | true | 是否選中checkbox或者radio,當(dāng)該列被選擇時(shí) |
| formatter | data-formatter | Function | undefined | 格式化單元格內(nèi)容,function(value, row, index), value:該cell本來(lái)的值,row:該行數(shù)據(jù),index:該行序號(hào)(從0開(kāi)始) |
| footerFormatter | data-footer-formatter | Function | undefined | 格式化footer內(nèi)容,function(rows),rows:所有行數(shù)據(jù) |
| events | data-events | Object | undefined | The cell 的事件監(jiān)聽(tīng),當(dāng)你使用formatter function的時(shí)候,有三個(gè)參數(shù): event: the jQuery event. value: 該cell的值 row: 該行的數(shù)據(jù) index: 該行的序號(hào) |
| sorter | data-sorter | Function | undefined | 自定義字段排序函數(shù),function(a, b) |
| sortName | data-sort-name | String | undefined | 當(dāng)列中有html等標(biāo)簽時(shí),只排序?qū)嶋H內(nèi)容(忽略標(biāo)簽和樣式),例如字段為:”abc“,則sortName=abc |
| cellStyle | data-cell-style | Function | undefined | 單元格樣式,支持css和classes,function(value, row, index) value: 該cell的值 row: 該行的數(shù)據(jù) index: 該行的序號(hào) |
| searchable | data-searchable | Boolean | true | 搜索時(shí)是否搜索此列 |
| searchFormatter | data-search-formatter | Boolean | true | 搜索是否使用格式化后的數(shù)據(jù)(即顯示在頁(yè)面上的數(shù)據(jù)) |
事件:
?$('#table').bootstrapTable({
onEventName: function (arg1, arg2, ...) {
// ...
}
});
$('#table').on('event-name.bs.table', function (e, arg1, arg2, ...) {
// ...
});
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
| onAll | all.bs.table | name, args | 所有的事件都會(huì)觸發(fā)該事件,參數(shù)包括: name:事件名, args:事件的參數(shù)。 |
| onClickRow | click-row.bs.table | row, $element | 當(dāng)用戶(hù)點(diǎn)擊某一行的時(shí)候觸發(fā),參數(shù)包括: row:點(diǎn)擊行的數(shù)據(jù), $element:tr 元素, field:點(diǎn)擊列的 field 名稱(chēng)。 |
| onDblClickRow | dbl-click-row.bs.table | row, $element | 當(dāng)用戶(hù)雙擊某一行的時(shí)候觸發(fā),參數(shù)包括: row:點(diǎn)擊行的數(shù)據(jù), $element:tr 元素, field:點(diǎn)擊列的 field 名稱(chēng)。 |
| onClickCell | click-cell.bs.table | field, value, row, $element | 當(dāng)用戶(hù)點(diǎn)擊某一列的時(shí)候觸發(fā),參數(shù)包括: field:點(diǎn)擊列的 field 名稱(chēng), value:點(diǎn)擊列的 value 值, row:點(diǎn)擊列的整行數(shù)據(jù), $element:td 元素。 |
| onDblClickCell | dbl-click-cell.bs.table | field, value, row, $element | 當(dāng)用戶(hù)雙擊某一列的時(shí)候觸發(fā),參數(shù)包括: field:點(diǎn)擊列的 field 名稱(chēng), value:點(diǎn)擊列的 value 值, row:點(diǎn)擊列的整行數(shù)據(jù), $element:td 元素。 |
| onSort | sort.bs.table | name, order | 當(dāng)用戶(hù)對(duì)列進(jìn)行排序時(shí)觸發(fā),參數(shù)包含: name: 排序列字段名 order: 排序列的順序 |
| onCheck | check.bs.table | row | 當(dāng)用戶(hù)檢查行時(shí)觸發(fā),參數(shù)包含: row: 與單擊的行對(duì)應(yīng)的記錄. $element: 選中DOM元素. |
| onUncheck | uncheck.bs.table | row | 在用戶(hù)取消選中行時(shí)觸發(fā),參數(shù)包含:? row: 與單擊的行對(duì)應(yīng)的記錄. $element: 取消選中DOM元素. |
| onCheckAll | check-all.bs.table | rows | 當(dāng)用戶(hù)檢查所有行時(shí)觸發(fā),參數(shù)包含: rows: 與新檢查的行對(duì)應(yīng)的記錄數(shù)組 |
| onUncheckAll | uncheck-all.bs.table | rows | 當(dāng)用戶(hù)取消選中所有行時(shí)觸發(fā),參數(shù)包含: rows:與先前檢查的行對(duì)應(yīng)的記錄數(shù)組 |
| onCheckSome | check-some.bs.table | rows | 當(dāng)用戶(hù)檢查某些行時(shí)觸發(fā),參數(shù)包含:? rows: 與先前檢查的行對(duì)應(yīng)的記錄數(shù)組. |
| onUncheckSome | uncheck-some.bs.table | rows | 當(dāng)用戶(hù)取消選中某些行時(shí)觸發(fā),參數(shù)包含: rows: 與先前檢查的行對(duì)應(yīng)的記錄數(shù)組. |
| onLoadSuccess | load-success.bs.table | data | 在成功加載遠(yuǎn)程數(shù)據(jù)時(shí)觸發(fā) |
| onLoadError | load-error.bs.table | status | 在加載遠(yuǎn)程數(shù)據(jù)時(shí)發(fā)生某些錯(cuò)誤時(shí)觸發(fā). |
| onColumnSwitch | column-switch.bs.table | field, checked | 切換列可見(jiàn)時(shí)觸發(fā). |
| onColumnSearch | column-search.bs.table | field, text | 在按列搜索時(shí)觸發(fā) |
| onPageChange | page-change.bs.table | number, size | 更改頁(yè)碼或頁(yè)面大小時(shí)觸發(fā). |
| onSearch | search.bs.table | text | 在搜索表時(shí)觸發(fā). |
| onToggle | toggle.bs.table | cardView | 切換表視圖時(shí)觸發(fā). |
| onPreBody | pre-body.bs.table | data | 在呈現(xiàn)表體之前觸發(fā) |
| onPostBody | post-body.bs.table | none | 在表體表示并在DOM中可用之后觸發(fā) |
| onPostHeader | post-header.bs.table | none | 在表頭之后觸發(fā),并在DOM中可用 |
| onExpandRow | expand-row.bs.table | index, row, $detail | 當(dāng)點(diǎn)擊詳細(xì)圖標(biāo)展開(kāi)詳細(xì)頁(yè)面的時(shí)候觸發(fā)。 |
| onCollapseRow | collapse-row.bs.table | index, row | 當(dāng)點(diǎn)擊詳細(xì)圖片收起詳細(xì)頁(yè)面的時(shí)候觸發(fā)。 |
| onRefreshOptions | refresh-options.bs.table | options | 在刷新選項(xiàng)之后和在銷(xiāo)毀和初始化表之前觸發(fā). |
| onRefresh | refresh.bs.table | params | 單擊刷新按鈕后觸發(fā). |
方法:
| getOptions | none | 返回表格的 Options。 | getOptions |
| getSelections | none | 返回所選的行,當(dāng)沒(méi)有選擇任何行的時(shí)候返回一個(gè)空數(shù)組。 | getSelections |
| getAllSelections | none | 返回所有選擇的行,包括搜索過(guò)濾前的,當(dāng)沒(méi)有選擇任何行的時(shí)候返回一個(gè)空數(shù)組。 | getAllSelections |
| getData | useCurrentPage | 或者當(dāng)前加載的數(shù)據(jù)。假如設(shè)置 useCurrentPage 為 true,則返回當(dāng)前頁(yè)的數(shù)據(jù)。 | getData |
| getRowByUniqueId | id | 根據(jù) uniqueId 獲取行數(shù)據(jù)。 | getRowByUniqueId |
| load | data | 加載數(shù)據(jù)到表格中,舊數(shù)據(jù)會(huì)被替換。 | load |
| showAllColumns | none | 顯示所有列. | showAllColumns |
| hideAllColumns | none | 隱藏所有列. | hidAllColumns |
| append | data | 添加數(shù)據(jù)到表格在現(xiàn)有數(shù)據(jù)之后。 | append |
| prepend | data | 插入數(shù)據(jù)到表格在現(xiàn)有數(shù)據(jù)之前。 | prepend |
| remove | params | 從表格中刪除數(shù)據(jù),包括兩個(gè)參數(shù): field: 需要?jiǎng)h除的行的 field 名稱(chēng)。 values: 需要?jiǎng)h除的行的值,類(lèi)型為數(shù)組。 | remove |
| removeAll | - | 刪除表格所有數(shù)據(jù)。 | removeAll |
| removeByUniqueId | id | 根據(jù) uniqueId 刪除指定的行。 | removeByUniqueId |
| insertRow | params | 插入新行,參數(shù)包括: index: 要插入的行的 index。 row: 行的數(shù)據(jù),Object 對(duì)象。 | insertRow |
| updateRow | params | 更新指定的行,參數(shù)包括: index: 要更新的行的 index。 row: 行的數(shù)據(jù),Object 對(duì)象。 | updateRow |
| showRow | params | 顯示指定的行,參數(shù)包括: index: 要更新的行的 index 或者 uniqueId。 isIdField: 指定 index 是否為 uniqueid。 | showRow-hideRow |
| hideRow | params | 顯示指定的行,參數(shù)包括: index: 要更新的行的 index。 uniqueId: 或者要更新的行的 uniqueid。 | showRow-hideRow |
| getRowsHidden | show | 獲取所有行隱藏,如果show參數(shù)為true,行將再次顯示,否則,方法 只返回隱藏的行. | |
| mergeCells | options | 將某些單元格合并到一個(gè)單元格,選項(xiàng)包含以下屬性: index:行索引 field:字段名稱(chēng) rowspan:要合并的rowspan數(shù)量? colspan:要合并的colspan數(shù)量 | |
| updateCell | params | 更新一個(gè)單元格,params包含以下屬性: index:行索引? field:字段名稱(chēng) value:新字段值 | |
| refresh | params | 刷新遠(yuǎn)程服務(wù)器數(shù)據(jù),可以設(shè)置?{silent:true}?以靜默方式刷新數(shù)據(jù),并設(shè)置?{url:newUrl}?更改URL。 要提供特定于此請(qǐng)求的查詢(xún)參數(shù),請(qǐng)?jiān)O(shè)置?{query:{foo:’bar’}} | |
| refreshOptions | options | 刷新選項(xiàng) | |
| resetSearch | text | 設(shè)置搜索文本 | |
| showLoading | none | 顯示加載狀態(tài). | |
| hideLoading | none | 隱藏加載狀態(tài) | |
| checkAll | none | 檢查所有當(dāng)前頁(yè)面行. | |
| uncheckAll | none | 取消選中所有當(dāng)前頁(yè)面行 | |
| check | index | 檢查一行,行索引從0開(kāi)始. | |
| uncheck | index | 取消選中一行,行索引從0開(kāi)始. | |
| checkBy | params | 按值數(shù)組檢查一行,參數(shù)包含: field:用于查找記錄的字段的名稱(chēng) values:要檢查的行的值數(shù)組 例:? $(“#table”).bootstrapTable(“checkBy”, {field:”field_name”, values:[“value1”,”value2”,”value3”]}) | |
| uncheckBy | params | 按值數(shù)組取消選中一行,參數(shù)包含: field:用于查找記錄的字段的名稱(chēng) values:要取消選中的行的值的數(shù)組 例:? $(“#table”).bootstrapTable(“uncheckBy”, {field:”field_name”, values:[“value1”,”value2”,”value3”]}) | |
| resetView | params | 重置引導(dǎo)表視圖,例如重置表高度. | |
| resetWidth | none | 調(diào)整頁(yè)眉和頁(yè)腳的大小以適合當(dāng)前列寬度 | |
| destroy | none | 銷(xiāo)毀引導(dǎo)表. | |
| showColumn | field | 顯示指定的列. | |
| hideColumn | field | 隱藏指定的列. | |
| getHiddenColumns | - | 獲取隱藏的列。 | |
| getVisibleColumns | - | 獲取可見(jiàn)列。 | |
| scrollTo | value | 滾動(dòng)到指定位置,單位為 px,設(shè)置 ‘bottom’ 表示跳到最后。 | |
| getScrollPosition | none | 獲取當(dāng)前滾動(dòng)條的位置,單位為 px。 | |
| filterBy | params | (只能用于 client 端)過(guò)濾表格數(shù)據(jù), 你可以通過(guò)過(guò)濾{age: 10}來(lái)顯示 age 等于 10 的數(shù)據(jù)。 | |
| selectPage | page | 跳到指定的頁(yè)。 | |
| prevPage | none | 跳到上一頁(yè)。 | |
| nextPage | none | 跳到下一頁(yè)。 | |
| togglePagination | none | 切換分頁(yè)選項(xiàng)。 | |
| toggleView | none | 切換 card/table 視圖 | |
| expandRow | index | 如果詳細(xì)視圖選項(xiàng)設(shè)置為T(mén)rue,請(qǐng)展開(kāi)具有通過(guò)參數(shù)傳遞的索引的行. | |
| collapseRow | index | 如果詳細(xì)視圖選項(xiàng)設(shè)置為T(mén)rue,則折疊具有通過(guò)參數(shù)傳遞的索引的行. | |
| expandAllRows | is subtable | 如果詳細(xì)視圖選項(xiàng)設(shè)置為T(mén)rue,請(qǐng)展開(kāi)所有行. | |
| collapseAllRows | is subtable | 如果詳細(xì)信息視圖選項(xiàng)設(shè)置為T(mén)rue,則折疊所有行. |
總結(jié)
以上是生活随笔為你收集整理的BootstrapTable中文文档的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Java项目中使用Freemarker生
- 下一篇: 2021年三亚旅游行业发展现状分析:旅游