• Docs
  • API
  • Help
  • Blog
  • GitHub

›Exposed API

Getting Started

  • About
  • Getting Started
  • Bootstrap 4
  • Migration

Basic Usage

  • Work on Row
  • Work on Column
  • Table Sort
  • Row Selection
  • Column Filter
  • Cell Edit
  • Pagination
  • Expandable Row

Remote Table

  • Work on Remote
  • Overlay

Table Toolkits

  • Getting Started
  • Table Search
  • Export to CSV
  • Column Toggle

Exposed API

  • Introduction

Introduction Exposed API

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.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

Trigger Cell Editing:

this.node.cellEditContext.startEditing(0, 1); // rowindex, columnindex

← Column Toggle
Docs
Getting StartedAPI References
Community
Stack OverflowProject ChatTwitter
More
BlogGitHubStar
Copyright © 2020 react-bootstrap-table2.