Incorrect width calculated until resize
I am having a strange issue on some of my grids where the incorrect width will be calculated (too wide) until the window is resized. The instantiation options are the same between all the grids, and there are roughly the same amount of columns.
I think we'd need a plunker or similar that allows us to reliably replicate the problem in order to do anything with this. Are you able to provide a plunker?
http://plnkr.co/edit/7X7s6dJsXZ8GMQVk9mFK?p=preview
(using chrome)
i have a similar problem.
click resize button, everything fine.
any idea?
Unfortunately I can't provide a stripped down version of our app, which is entirely frustrating, and I realise that this is not much help at all.
I have also noticed that the height of the .ui-grid-cell get's increased by 1px for every resize event fired by the browser.
What version are you on? We had in the past some issues that looked like this - perhaps upgrading to unstable would resolve this issue?
I too have similar type of setup as @alexmccabe mentioned, and I do see the same rendering problem happening one in 10 times maybe. Clicking browser refresh fixes it. I am using Grid 3.0.0-RC.18 with Angular 1.3.11
We have narrowed it down to this; the grid is being calculated before the page / parent elements dimensions have been calculated. If you can, try delaying the instantiation of the ui-grid until page load is complete.
I got the same issue on v3.0.0-rc.16. #2700
Do this as a workaround:
window.dispatchEvent(new Event('resize'));
After setting data.
Same problem with v3.0.0-RC.18-7774d30 When resizing the browser, making the grid smaller, it always looks like the screenshot from rokugou but not when making it larger. (Chrome, ok with FF)
The workarround from httpete works for me.
The workaround works for me too, from what I can tell so far. Will post again when we have tested on more of our grids. Thanks @httpete.
If you have issues with IE11, try this:
setTimeout(function(){
var evt = document.createEvent('UIEvents');
evt.initUIEvent('resize', true, false,window,0);
window.dispatchEvent(evt);
}, 100);
I think I have a better fix, that isn't a hack.
What I found was, if the page does not have scrollbars and something on the page initiates this, the grid dies. To prevent this, I just do:
html { overflow-y: scroll; /* we always want to show scrollbars to prevent bouncing, and resizing issues with the grid */ }
so we always show scrollbars whether or not the content forces it. Overall, I wish the authors of this grid would have used standard