React-bootstrap-table2: Custom Search Bar Without Button?

Created on 25 Mar 2019  路  6Comments  路  Source: react-bootstrap-table/react-bootstrap-table2

The default Searchbar has no

Most helpful comment

Answered my own question. For the benefit of others this may help in future, here's how I did it (note disabled lines won't be necessary unless you are using eslint):

import React from 'react';

const TableSearchBar = (props) => {
  let input;
  const handleChange = () => {
    props.onSearch(input.value); //eslint-disable-line
  };
  return (
    <div>
      <label htmlFor="table-search-bar" className="w-100">
        <span className="sr-only">Search This Data Table</span>
        <input
          id="table-search-bar"
          className="form-control form-control-sm"
        ref={n => input = n} //eslint-disable-line
          type="text"
          placeholder="Search"
          onChange={handleChange}
        />
      </label>
    </div>
  );
};

export default TableSearchBar;

All 6 comments

Answered my own question. For the benefit of others this may help in future, here's how I did it (note disabled lines won't be necessary unless you are using eslint):

import React from 'react';

const TableSearchBar = (props) => {
  let input;
  const handleChange = () => {
    props.onSearch(input.value); //eslint-disable-line
  };
  return (
    <div>
      <label htmlFor="table-search-bar" className="w-100">
        <span className="sr-only">Search This Data Table</span>
        <input
          id="table-search-bar"
          className="form-control form-control-sm"
        ref={n => input = n} //eslint-disable-line
          type="text"
          placeholder="Search"
          onChange={handleChange}
        />
      </label>
    </div>
  );
};

export default TableSearchBar;

I think react-bootstrap-table2 already support a lots of way to let developer to custom the search bar, export csv button, pagination etc. here is an example to show how to completely custom a search component.

@AllenFang Any examples on how to do the same with pagination? I didn't see a full customization in the docs.

@AllenFang Also the dropdown filters that can be added to table columns - I need a way to customize those so I can add a

@Jayboy75
docs
example


use column.formatter to custom your column.

@AllenFang Thanks for pointing me in the right direction. Is there a way to create a custom filter dropdown so I can add a

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cnav007 picture cnav007  路  4Comments

josefheld picture josefheld  路  3Comments

SandeepKapalawai picture SandeepKapalawai  路  3Comments

primakashi picture primakashi  路  3Comments

eylonronen picture eylonronen  路  3Comments