ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Incorrect width calculated until resize

Open alexmccabe opened this issue 11 years ago • 16 comments

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.

alexmccabe avatar Jan 07 '15 17:01 alexmccabe

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?

PaulL1 avatar Jan 11 '15 01:01 PaulL1

http://plnkr.co/edit/7X7s6dJsXZ8GMQVk9mFK?p=preview screen shot 2015-01-12 at 6 02 32 pm (using chrome) i have a similar problem. click resize button, everything fine.

any idea?

rokugou avatar Jan 12 '15 10:01 rokugou

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.

alexmccabe avatar Jan 15 '15 09:01 alexmccabe

What version are you on? We had in the past some issues that looked like this - perhaps upgrading to unstable would resolve this issue?

PaulL1 avatar Jan 29 '15 23:01 PaulL1

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

kmittal avatar Feb 02 '15 18:02 kmittal

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.

alexmccabe avatar Feb 03 '15 10:02 alexmccabe

I got the same issue on v3.0.0-rc.16. #2700

tony0918 avatar Feb 05 '15 08:02 tony0918

Do this as a workaround:

window.dispatchEvent(new Event('resize'));

After setting data.

httpete avatar Feb 05 '15 19:02 httpete

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.

aikrez avatar Feb 06 '15 07:02 aikrez

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.

alexmccabe avatar Feb 06 '15 10:02 alexmccabe

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);

httpete avatar Feb 10 '15 15:02 httpete

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 html which is more solid than floats which never work.Either that, or use the divs and use display: table for the css mechanism.

httpete avatar Feb 22 '15 17:02 httpete

I'm not seeing the problem with latest unstable on @rokugou's plunker. Can anyone confirm?

c0bra avatar Feb 23 '15 23:02 c0bra

@c0bra latest unstable version work for me. Thank you.

rokugou avatar Feb 24 '15 03:02 rokugou

Great! Thanks.

c0bra avatar Feb 24 '15 13:02 c0bra

I have a issue that the scenario is: has two grids, one has only one column with custom cell template with all necessary classes to ui-grid work.

When access the page that has this two grids, wait 5 sec, and click on tab that have this grid that I have mentioned, data isn't showed util I resize the window (browser). Curiously, if I click on the tab before this 5 sec, the data is showed properly.

I have tried all kind of solution and nothing works.

odravison avatar Aug 04 '17 16:08 odravison