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

Inputs inside cells are focused unintentionally #18

Closed
msojka opened this issue Jun 21, 2016 · 7 comments
Closed

Inputs inside cells are focused unintentionally #18

msojka opened this issue Jun 21, 2016 · 7 comments

Comments

@msojka
Copy link

msojka commented Jun 21, 2016

Same as #398

I'd like to make an editable spreadsheet with the input in each cell. Everything works fine and fast the only issue is that when I focus any input every other n-th row input is focused as well (n depends on the height of the table).

Clicked:
screen shot 2016-06-10 at 17 27 54

Scrolled:
screen shot 2016-06-10 at 17 28 30

@KamranAsif
Copy link
Contributor

Can you please create a jsfiddle for this? You can fork off https://jsfiddle.net/uq8osbp1/

@wcjordan
Copy link
Member

@msojka I've seen a similar issue with images which happened because the table recycles rows and updates the props on them for performance. With images updating of the props would keep the old image and just update the src attribute on it, leading to the wrong images appearing until you stopped scrolling.

I was able to work around the issue by setting a key prop on the image element (at the cost of not getting to recycle our image elements).

A fiddle as Kam mentioned, or details on how your focused components are specified would be great. Thanks!

@msojka
Copy link
Author

msojka commented Jun 22, 2016

@KamranAsif here is minimum jsfiddle to replicate the issue: https://jsfiddle.net/msojka/f6aqLe0y/1/

Click to focus a1 input and scroll down to see multiple inputs created and focused as well (where exactly depends on height).

@KamranAsif
Copy link
Contributor

@msojka As @wcjordan mentioned, you can use the key property to fix this:

<input 
  key={this.props.rowIndex} 
  type="text" 
  value={this.props.data[this.props.rowIndex][this.props.columnKey]} 
/>

https://jsfiddle.net/9jzy061k/3/

@msojka
Copy link
Author

msojka commented Jun 27, 2016

@KamranAsif ok that helped. Also note that I found it's important to add key to MyCell as well to ensure proper passing of props to the cells and children.

Anyways with this sorted out everything works great with one caveat. Scrolling (just scrolling) is terribly slow in IE 11. Even when stripped down to just a few data and simple cell content (divs instead of inputs).Chrome and FF are smooooth. Seems like IE render engine is just horrible. Anybody else experiencing same thing?

@KamranAsif
Copy link
Contributor

@msojka Hmm we haven't run into any issues like that yet. Does scrolling on this webpage also appear slow to you? http://schrodinger.github.io/fixed-data-table-2/example-reorder.html

@burakcan
Copy link
Contributor

The whole point of the fixed-data-table is to work with "fixed data". It's optimisations comes from windowing and recycling. In the case of inputs, recycling is not possible and it will cause lots of performance loss. I think there's nothing to do here other than using keys and disabling recycling for that elements.

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

4 participants