react-bootstrap-table2/docs/exposed-api.md
2018-10-07 13:48:57 +08:00

1.1 KiB

id title sidebar_label
exposed-api Introduction Exposed API Introduction

react-bootstrap-table2 support some hooks function that you can use to know what state changes, for example: a row is select or unselect. In addition, we also allow you use React Refs to directly access the components so that you can easier to get some table states.

Live Demo

Add a Refs on BootstrapTable

<BootstrapTable
  ref={ n => this.node = n }
  ...
/>

Get Current Display Rows

this.node.table.props.data

Get Current Selected Rows

this.node.selectionContext.state.selected

Get Current Expanded Rows

this.node.rowExpandContext.state.expanded

Get Current Page

this.node.paginationContext.currPage

Get Current Size Per Page

this.node.paginationContext.currSizePerPage

Get Current Sorting Column

this.node.sortContext.state.sortColumn

Get Current Sorting Order

this.node.sortContext.state.sortOrder

Get Current Filters

this.node.filterContext.currFilters