Socket
Socket
Sign inDemoInstall

react-bootstrap-table2-toolkit

Package Overview
Dependencies
9
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-bootstrap-table2-toolkit

The toolkit for react-bootstrap-table2


Version published
Maintainers
1
Install size
166 kB
Created

Readme

Source

react-bootstrap-table2-toolkit

react-bootstrap-table2 support some additional features in react-bootstrap-table2-toolkit.

In the future, this toolkit will support other feature like row delete, insert etc. Right now we only support Table Search and CSV export.

Live Demo For Table Search

API&Props Definitation


Install

$ npm install react-bootstrap-table2-toolkit --save

Add CSS

// es5 
require('react-bootstrap-table2-toolkit/dist/react-bootstrap-table2-toolkit.min.css');

// es6
import 'react-bootstrap-table2-toolkit/dist/react-bootstrap-table2-toolkit.min.css';
import ToolkitProvider, { Search } from 'react-bootstrap-table2-toolkit';

const { SearchBar } = Search;
//...

  <ToolkitProvider
    keyField="id"
    data={ products }
    columns={ columns }
    search
  >
    {
      props => (
        <div>
          <h3>Input something at below input field:</h3>
          <SearchBar { ...props.searchProps } />
          <hr />
          <BootstrapTable
            { ...props.baseProps }
          />
        </div>
      )
    }
  </ToolkitProvider>
  1. You have to enable the search functionality via search prop on ToolkitProvider.

  2. ToolkitProvider is a wrapper of react context, you are supposed to wrap the BootstrapTable and SearchBar as the child of ToolkitProvider

  3. You should render SearchBar with searchProps as well. The position of SearchBar is depends on you.

Search Options

searchFormatted - [bool]

If you want to search on the formatted data, you are supposed to enable this props. react-bootstrap-table2 will check if you define the column.formatter when doing search.

<ToolkitProvider
  keyField="id"
  data={ products }
  columns={ columns }
  search={ {
    searchFormatted: true
  } }
>
  // ...
</ToolkitProvider>

Export CSV

There are two step to enable the export CSV functionality:

  1. Give exportCSV prop as true on ToolkitProvider.
  2. Render ExportCSVButton with csvProps. The position of ExportCSVButton is depends on you.
import ToolkitProvider, { CSVExport } from 'react-bootstrap-table2-toolkit';

const { ExportCSVButton } = CSVExport;

<ToolkitProvider
  keyField="id"
  data={ products }
  columns={ columns }
  exportCSV
>
  {
    props => (
      <div>
        <ExportCSVButton { ...props.csvProps }>Export CSV!!</ExportCSVButton>
        <hr />
        <BootstrapTable { ...props.baseProps } />
      </div>
    )
  }
</ToolkitProvider>

Export CSV Options

fileName - [String]

Custom the csv file name.

separator - [String]

Custom the csv file separator.

ignoreHeader - [bool]

Default is false. Give true to avoid to attach the csv header.

noAutoBOM - [bool]

Default is true.

Keywords

FAQs

Last updated on 04 Aug 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc