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

How to expand focused search result when assigning text in the search textbox using code? #223

Closed
SomoKRoceS opened this issue Jan 3, 2018 · 2 comments

Comments

@SomoKRoceS
Copy link

Hello again :)

I am trying to force-search a term in the tree by code.
In other words, I want some text to be assigned to the search textbox (as a value, not a placeholder) in the moment the tree is loading up for the first time. I also want that the search will work with the focus, highlighting and expending.
The code I am using for the search method is the code presented in Storybook:
https://fritz-c.github.io/react-sortable-tree/storybook/?selectedKind=Basics&selectedStory=Search&full=0&down=1&left=1&panelRight=0&downPanel=storybook%2Fnotes%2Fpanel

So in the initial state I assigned to searchString a value passed to props instead of empty string ('').
searchFocusIndex is still 0. and searchFoundCount is null.

Well.. the value is assigned and appears in the search textbox, and the highlighting border of the selected matching node appears as well. But the tree wan't expending to that node.

I need that expansion so that the matching node will not be hidden by father (like triggering onChange on normal searching).

My only changes in the code:

this.state = {
      searchString: (this.props.x) ? this.props.x : '',
      searchFocusIndex: 0,
      searchFoundCount: null,
.
.
.

Thanks.

@borisyordanov
Copy link

Can you provide a sandbox of what you have so far?

@fritz-c fritz-c changed the title How to expend focused search result when assigning text in the search textbox using code? How to expand focused search result when assigning text in the search textbox using code? Jan 13, 2018
@fritz-c
Copy link
Member

fritz-c commented Jan 13, 2018

This is now fixed in v1.5.5

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

No branches or pull requests

3 participants