To use event syntax:
$('#table').bootstrapTable({
onEventName: function (arg1, arg2, ...) {
// ...
}
});
$('#table').on('event-name.bs.table', function (e, arg1, arg2, ...) {
// ...
});
| Option Event | jQuery Event | Parameter | Description |
|---|---|---|---|
| onAll | all.bs.table | name, args |
Fires when all events trigger, the parameters contain: name: the event name, args: the event data. |
| onClickRow | click-row.bs.table | row, $element, field |
Fires when user click a row, the parameters contain: row: the record corresponding to the clicked row, $element: the tr element, field: the field name corresponding to the clicked cell. |
| onDblClickRow | dbl-click-row.bs.table | row, $element, field |
Fires when user double click a row, the parameters contain: row: the record corresponding to the clicked row, $element: the tr element, field: the field name corresponding to the clicked cell. |
| onClickCell | click-cell.bs.table | field, value, row, $element |
Fires when user click a cell, the parameters contain: field: the field name corresponding to the clicked cell, value: the data value corresponding to the clicked cell, row: the record corresponding to the clicked row, $element: the td element. |
| onDblClickCell | dbl-click-cell.bs.table | field, value, row, $element |
Fires when user double click a cell, the parameters contain: field: the field name corresponding to the clicked cell, value: the data value corresponding to the clicked cell, row: the record corresponding to the clicked row, $element: the td element. |
| onSort | sort.bs.table | name, order |
Fires when user sort a column, the parameters contain: name: the sort column field name order: the sort column order. |
| onCheck | check.bs.table | row, $element |
Fires when user check a row, the parameters contain: row: the record corresponding to the clicked row. $element: the DOM element checked. |
| onUncheck | uncheck.bs.table | row, $element |
Fires when user uncheck a row, the parameters contain: row: the record corresponding to the clicked row. $element: the DOM element unchecked. |
| onCheckAll | check-all.bs.table | rows |
Fires when user check all rows, the parameters contain: rows: array of records corresponding to newly checked rows. |
| onUncheckAll | uncheck-all.bs.table | rows |
Fires when user uncheck all rows, the parameters contain: rows: array of records corresponding to previously checked rows. |
| onCheckSome | check-some.bs.table | rows |
Fires when user check some rows, the parameters contain: rows: array of records corresponding to newly checked rows. |
| onUncheckSome | uncheck-some.bs.table | rows |
Fires when user uncheck some rows, the parameters contain: rows: array of records corresponding to previously checked rows. |
| onLoadSuccess | load-success.bs.table | data | Fires when remote data is loaded successfully. |
| onLoadError | load-error.bs.table | status, res | Fires when some errors occur to load remote data. |
| onColumnSwitch | column-switch.bs.table | field, checked | Fires when switch the column visible. |
| onColumnSearch | column-search.bs.table | field, text | Fires when search by column. |
| onPageChange | page-change.bs.table | number, size | Fires when change the page number or page size. |
| onSearch | search.bs.table | text | Fires when search the table. |
| onToggle | toggle.bs.table | cardView | Fires when toggle the view of table. |
| onPreBody | pre-body.bs.table | data | Fires before the table body is rendered |
| onPostBody | post-body.bs.table | data | Fires after the table body is rendered and available in the DOM |
| onPostHeader | post-header.bs.table | none | Fires after the table header is rendered and availble in the DOM |
| onExpandRow | expand-row.bs.table | index, row, $detail | Fires when click the detail icon to expand the detail view. |
| onCollapseRow | collapse-row.bs.table | index, row | Fires when click the detail icon to collapse the detail view. |
| onRefreshOptions | refresh-options.bs.table | options | Fires after refresh the options and before destroy and init the table |
| onResetView | reset-view.bs.table | Fires when reset view of the table. | |
| onRefresh | refresh.bs.table | params | Fires after the click the refresh button. |
| onScrollBody | scroll-body.bs.table | Fires when table body scroll. |