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

iron-list does not show all items on bound array change #3319

Closed
dstefanox opened this issue Jan 22, 2016 · 5 comments
Closed

iron-list does not show all items on bound array change #3319

dstefanox opened this issue Jan 22, 2016 · 5 comments

Comments

@dstefanox
Copy link

Attached is example which demonstrates bug.
Simple component is created which contains iron-list, which is bound to array, which is filled on the click of a button on demo page.
When page is initially loaded, on first click, only first item is shown in iron-list, although list contains 15 items. On second click, list shows all items.
Attached archive contains two screenshots which illustrate problem, as well as minimal source code to reproduce issue.

bug-report-iron-list.zip

@dstefanox dstefanox changed the title iron-list does not show all items on array change iron-list does not show all items on bound array change Jan 22, 2016
@freshp86
Copy link

freshp86 commented Mar 6, 2016

I have faced the same issue, where only one element is rendered, even though the bound array has more elements. I noticed that resizing the window causes all of the elements in the bound array to be rendered. So my workaround for now is to fire a 'resize' event manually on the parent.

@jpodwys
Copy link

jpodwys commented Mar 8, 2016

I, too, would like to see this fixed.

@geekgonecrazy
Copy link

I have a case where we're loading some data over a websocket. I then update the Array. It behaves the same way as described by @dstefanox

@plequang
Copy link

Hi @dstefanox,

I think the behavior you observe is due to iron-list not being explicitely sized in you example, as explained in the iron-list documentation (https://elements.polymer-project.org/elements/iron-list) :

Important: iron-list must either be explicitly sized, or delegate scrolling to an explicitly sized parent. By "explicitly sized", we mean it either has an explicit CSS height property set via a class or inline style, or else is sized by other layout means (e.g. the flex or fit classes).

You can see the difference by adding the following style attribute to your example :

<iron-list id="requestList" items="{{requests}}" as="item" style="height: 400px">

Of course, you will probably prefer using layout classes rather than using such a fixed size.

In your example, it works on second click because after first click, iron-list has estimated the height to render all items (based on rendering one). That's also why you can see iron-list has changed its height after first click.

@freshp86: This is also what's happening when resizing the window, because iron-list re-render itself upon resize events.

I guess this issue should be moved to https://github.com/PolymerElements/iron-list

@tjsavage tjsavage added the 1.x label Sep 8, 2016
@TimvdLippe
Copy link
Contributor

@plequang is correct that <iron-list> needs an explicit size. Given the age of this issue and per above comment I assume it has been fixed in the mean time, I am closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants