Skip to content

Issues of table search #282

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

Closed
liqili opened this issue Feb 19, 2016 · 24 comments
Closed

Issues of table search #282

liqili opened this issue Feb 19, 2016 · 24 comments

Comments

@liqili
Copy link

liqili commented Feb 19, 2016

I have found some issues about Table Search functionality.
1.The search key matched the hidden column.
2.I met problems following the below steps.
a.SelectAll records
b.Search by some condition.Some records are filtered.
c.I still get all records including filtered records when submitting to backend .

@AllenFang
Copy link
Owner

@liqili, I'll check this out. Thanks :)

@liqili
Copy link
Author

liqili commented Feb 19, 2016

@AllenFang Thanks very much.Regarding issue 2,I think it's not a problem if I can get the record sets displayed in the screen.

@AllenFang
Copy link
Owner

@liqili, for issue 2, you can try this:

var options  = {
  //...
  afterSearch: function(searchText, result) {
      //result is the data which filtered
  }
}

//...

<BootstrapTable options={options}>

@liqili
Copy link
Author

liqili commented Feb 19, 2016

@AllenFang Fine.Thank you!

@AllenFang
Copy link
Owner

@liqili, if work, please let me know :)

@liqili
Copy link
Author

liqili commented Feb 19, 2016

@AllenFang Thanks,It satisfied my requirements.

@AllenFang
Copy link
Owner

Great, I will fix issues 1

@AllenFang
Copy link
Owner

For issues 1, I've fixed it and released on v1.5.2

@chriscostello9
Copy link

Maybe list a good example for those using ES6 linting, in your docs:

options={{sortName: 'name',
  sortOrder: 'asc',
  afterSearch: (searchText, result) => {
    this.afterSearch(result);
  }
}}

Then, the afterSearch function to do whatever it is you want:

afterSearch(result) {
  const filtered = new Set(result.map(item => item.myPropName));

  this.setState({
    filtered: selected,
  });
}

@AllenFang
Copy link
Owner

@chriscostello9, thanks your feedback. I'll improve my document in near future :)

@waiter
Copy link

waiter commented Mar 1, 2016

@AllenFang
Since the search can't search text in object, so can't you add a switch to enable the search key matched the hidden column? Or other better ways??

I've read the source code, the targetVal.toString() makes the object to [Object object] ...

@AllenFang
Copy link
Owner

@waiter, I think it's hard to search on an object. But if I make the searching on hidden column configurable, is that helpful for you?

@AllenFang
Copy link
Owner

@waiter, btw, your case is common, if you really need a object can be searched, A customization search can achieve your requirement. I mean just handle search and state outside the react-bootstrap-table.

@waiter
Copy link

waiter commented Mar 2, 2016

@AllenFang
Make the searching on hidden column configurable is what I want. So could you add this feature.
Handle search and state outside the react-bootstrap-table means I should reset the BootstrapTable's prop data every time?

@AllenFang
Copy link
Owner

@waiter, I think I can add this feature in near future.

Handle search and state outside the react-bootstrap-table means I should reset the BootstrapTable's prop data every time?

yes, after searching, just render new props data on table

@waiter
Copy link

waiter commented Mar 2, 2016

@AllenFang
OK, thank you~

@AllenFang
Copy link
Owner

@waiter, @liqili I've released the newest version v1.6.0
Currently, hidden column can be searched by default, if you want some hidden cant be searched, add searchable={false} on <TableHeaderColumn>

Sorry for this functionality changed, feel free to discuss with me

@waiter
Copy link

waiter commented Mar 7, 2016

@AllenFang
Great to hear that! Thank you~
But, it doesn't work. Did you write the wrong logical operator??
you write !hidden && searchable to check wheather it can be searched,
but I think it should be !hidden || searchable since when column is hidden, then hidden={true}.

Pleace check it ...

@AllenFang
Copy link
Owner

I made a big mistake, I will solve this issue quickly. Thanks

@waiter
Copy link

waiter commented Mar 8, 2016

@AllenFang
Great~

@AllenFang
Copy link
Owner

@liqili @waiter, sorry for my mistake, v1.6.1 is the newest version, hidden column can be searched by default. you can set searchable={false} to disable. Feel free to ask anything

@waiter
Copy link

waiter commented Mar 9, 2016

@AllenFang
Thank you, it works now~~

@nguyenchanhnghia
Copy link

hi all. I have a issue of search table. search is not working when data of cell is object. How to search realizable?
Thank!

@AllenFang
Copy link
Owner

@nguyenchanhnghia, sorry for lately reply, I've opened #569 and have a plane to deal with it.

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

No branches or pull requests

5 participants