Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combination of Add with Sort and Filter #366

Closed
dana2208 opened this issue Mar 28, 2016 · 3 comments
Closed

Combination of Add with Sort and Filter #366

dana2208 opened this issue Mar 28, 2016 · 3 comments
Labels

Comments

@dana2208
Copy link
Contributor

Hi,

Sort issue with the code provided at the end of the issue:

  1. Sort Product Name
  2. Add a product whose name should appear in the middle (for example "Item name 01" should appear between "Item name 0" and "Item name 1").
  3. New item is added at the bottom.

Filter issue with the code provided at the end of the issue:

  1. Filter Product Name (for example enter 0 in the filter textbox)
  2. Add a product whose name shouldn't appear (for example "Item name 12").
  3. New item is not filtered.
import React from 'react';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';

function getProducts() {
  const products = [];
  const startId = products.length;
  for (let i = 0; i < 12; i++) {
    const id = startId + i;
    products.push({
      id: id,
      name: 'Item name ' + id
    });
  }
  return products;
}

export default class Test extends React.Component {
  constructor(props) {
    super(props);
    this.products = getProducts();
  }

  render() {
    return (
      <BootstrapTable data={ this.products } insertRow={ true }>
        <TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn>
        <TableHeaderColumn dataField='name' filter={ { type: 'TextFilter' } } dataSort={ true }>
          Product Name</TableHeaderColumn>
      </BootstrapTable>
      );
  }
}

Thanks

@AllenFang AllenFang added the bug label Mar 28, 2016
@AllenFang
Copy link
Owner

@dana2208, Thanks for issues report, I'll check this out 👍

@AllenFang
Copy link
Owner

@dana2208, I've fixed it and will released on next version

@AllenFang
Copy link
Owner

@dana2208, release on v2.1.1. Check it out :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants