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

Add posibility to force redraw. #1340

Closed
wants to merge 3 commits into from

Conversation

filipgorny
Copy link

Relating to this stackoveflow entry: http://stackoverflow.com/questions/22066261/handsontable-doesnt-appear-before-click-or-some-other-operation/22070768#22070768

I had an issue using handsontable with backbone.

I run the plugin on element not attached to the dom, and it doesn't show until I click on the table.
I tried to do ht.render() but it didn't work. Adding the parameter for FORCE option solved problem.

@filipgorny
Copy link
Author

Unfortunately as I can see this is an expected behavior - not to draw

when the element is not visible. This is a blocker when using Backbone View.

@filipgorny
Copy link
Author

I decided to use custom forceDraw() method.

@renathy
Copy link

renathy commented Feb 27, 2014

I am using knockout binding that happens inside modal window. Modal window as well as DOM element for table is not visible first and I have the same behavior - element is not drawn until clicked.

@filipgorny
Copy link
Author

@renathy you can use this forceDraw() method after binding.

@renathy
Copy link

renathy commented Feb 27, 2014

I am not able to understand how to use it. I do not know how to get handsontable instance. I use this binding (at the bottom of js part there is binding with 'init' and 'update'): http://jsfiddle.net/calvinslusarski/x3ejL/2/, this example works fine, but not mine on real application.

@psmolenski
Copy link
Contributor

The reason why an element needs to be visible in order Hansontable to render is because there are quite a few places where Handsontable reads height, width and offsets of table elements. If the table is not visible, then the browser can't define those properties accurately, therefore there is a hight risk that table won't be displayed as expected or even there might be some exceptions thrown.

I strongly advice not to force the table render, when the table container is not visible. Instead you should wait until a View becomes visible and then call render() method (without force parameter).

@psmolenski psmolenski closed this Feb 28, 2014
@marcok
Copy link

marcok commented Mar 4, 2014

is there any relation to my issue? #1349

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

Successfully merging this pull request may close these issues.

None yet

4 participants