material icon indicating copy to clipboard operation
material copied to clipboard

virtual-repeat: does not render items if it begins in hidden state

Open uriva opened this issue 11 years ago • 18 comments

http://codepen.io/uriva/pen/PqMMqV

uriva avatar Aug 26 '15 13:08 uriva

+1 I just ran across this issue too

Anaphase avatar Aug 26 '15 16:08 Anaphase

This could possibly be related to a similar bug documented in #4499.

Anaphase avatar Sep 08 '15 23:09 Anaphase

Fixed as of 1.0-rc4

kseamon avatar Nov 20 '15 16:11 kseamon

Probably related, virtual-repeat does not render when it is in a sidnav that is initially hidden. I'm using 1.0.5 and it's still happening. Works fine in sidenav that is initially open.

apils avatar Feb 24 '16 19:02 apils

I am using 1.1.0-rc2 and it is still an issue. I was setting the scope for my repeater items before setting visible the md-virtual-repeat component. When setting the component visible, I then used this hack to force a redraw - angular.element(window).triggerHandler('resize');

impressto avatar Jun 14 '16 14:06 impressto

I am on 1.1.0-rc5 and the problem still exists.

demsey2 avatar Aug 08 '16 03:08 demsey2

Also on 1.1.0-rc5 and the problem persist, ill test it on rc4

jbernard1 avatar Aug 30 '16 15:08 jbernard1

I came across this thread when looking for a cause of my virtualRepeat staying hidden. Since it was in nested UI-Router states, I though bug described here was the case.

Turned out the cause was trivial: I haven't added CSS height property to md-virtual-repeat-container element. (width for horizontal mode) Analogous ng-repeat works without it, so it should be mentioned in the docs…

Unrelated to the bug, but I hope someone will find this helpful.

vucalur avatar Sep 05 '16 10:09 vucalur

My quick hack was just wrapping the md-virtual-repeat-container with an ng-if:

<div ng-if="someCtrl.isSidenavReady"> <md-virtual-repeat-container> <md-virtual-repeat md-on-demand md-virtual-repeat="thing in someCtrl.things"> </md-virtual-repeat> </md-virtual-repeat-container> </div>

I set the flag to true when the button that opens the sidenav is clicked. Causes the repeater to re-draw and works for me temporarily!

chas-bean avatar Sep 07 '16 14:09 chas-bean

@CharlesBean this is what I ended up doing as well

Anaphase avatar Sep 07 '16 15:09 Anaphase

Still an intermittent problem in 1.1.4. I don't think it matters if it begins in a hidden state like the title might suggest. I could reproduce it intermittently whenever it would go from hidden to shown regardless of what the state started at upon page load. The ng-if work-around would have worked, but I couldn't use it in my case. However, I found that toggling just the visibility via ng-style also works around the issue.

aeslinger0 avatar Oct 06 '17 18:10 aeslinger0

+1 still an issue for me in 1.1.3

cmacdonnacha avatar Nov 22 '17 16:11 cmacdonnacha

The issue within a SideNav was fixed in 1.1.2 (https://github.com/angular/material/issues/7309).

If you are still seeing this issue in 1.1.5, we're tracking an issue when inside of md-tabs in https://github.com/angular/material/issues/11002. If you can provide some information there and a CodePen reproduction, it would be appreciated.

If you are seeing this outside of md-tabs, please open a new issue with a reproduction.

Splaktar avatar Dec 10 '17 11:12 Splaktar

@Splaktar I'm still getting this issue in 1.1.7 when a <md-virtual-repeat-container> is inside a <md-menu-content>. The content is initially blank when I open the menu, but as soon as I resize the window, the content appears.

Copy-and-pasting the same <md-virtual-repeat-container> outside the <md-menu-content> works - the items appear right away without resizing.

I'm guessing this has the same cause as the md-tabs issue.

I can workaround this by manually firing a resize event after opening the menu.

aj-r avatar Feb 21 '18 17:02 aj-r

I'm not sure how I unassigned @kseamon but it was unintentional.

aj-r avatar Feb 21 '18 17:02 aj-r

Yea. This is quite a big issue for us. Having to manually firing a resize event is just too hacky.

cmacdonnacha avatar Feb 22 '18 16:02 cmacdonnacha

@aj-r no problem on the unassignment, GitHub just automatically does that since he is no longer a member of this team.

Can you please open a new issue for this issue with menus and include a CodePen demo? Please reference this issue in the new issue.

Splaktar avatar Feb 26 '18 02:02 Splaktar