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

bug: Weird Collection Repeat Behavior #3034

Closed
andrewmcgivery opened this issue Feb 4, 2015 · 7 comments
Closed

bug: Weird Collection Repeat Behavior #3034

andrewmcgivery opened this issue Feb 4, 2015 · 7 comments

Comments

@andrewmcgivery
Copy link
Contributor

Type: bug

Platform: all

Reference CodePen: http://codepen.io/andrewmcgivery/pen/ogGmNW

So, I took a ng-repeat and made it a collection-repeat. In that collection repeat, I set the width to 100%. This gave me un expected behavior.

So, I tried setting the following CSS, and it made it work as expected.

.item {
width:100%
}

I also noticed in the docs that it says I need to use the following CSS which seems to accomplish the same as the CSS I used.

.my-item {
left: 0;
right: 0;
}

This seems like a weird behavior to me (possibly a misunderstanding). I figured if I said 100% it would assume I mean width: 100%.

Next experiment is setting collection-item-width to 25% and leaving the suggested css (left: 0, right: 0). This gave even weirder behavior. The items were all over the place.

To fix this, I had to put in my css for list items width:25%.

Am I just misunderstanding something here? Do the docs need to be updated to be a little more clear?

@ajoslin
Copy link
Contributor

ajoslin commented Feb 5, 2015

Could you post a little bit of markup for each of your examples?

Not sure I'm understanding the problem here.

@andrewmcgivery
Copy link
Contributor Author

From the CodePen...

First Example

<ion-item class="item-avatar" collection-repeat="item in items" collection-item-width="'100%'" collection-item-height="'70px'">
    <img src="{{item.user.picture.thumbnail}} " />
    <h2>{{item.user.name.first}} {{item.user.name.last}}</h2>
    <p>{{item.user.location.city}} {{item.user.password}}</p>
</ion-item>

Second Example

<ion-item class="item-avatar" collection-repeat="item in items" collection-item-width="'25%'" collection-item-height="'70px'">
    <img src="{{item.user.picture.thumbnail}} " />
    <h2>{{item.user.name.first}} {{item.user.name.last}}</h2>
    <p>{{item.user.location.city}} {{item.user.password}}</p>
</ion-item>

@ajoslin
Copy link
Contributor

ajoslin commented Feb 5, 2015

Oh, I didn't see the codepen! My fault.

@ajoslin
Copy link
Contributor

ajoslin commented Feb 5, 2015

Both 25% and 100% seem to be working as intended for me.

collection-repeat's default behavior should probably do the width: 100% for you, to cover 99% of cases.

@andrewmcgivery
Copy link
Contributor Author

I changed the codepen to the 25% example. Scroll up and down a bit and the layout will start to mess up.

@ajoslin
Copy link
Contributor

ajoslin commented Feb 6, 2015

@andrewmcgivery this is actually just a CSS bug. The height of your items in css is different than the amount defined by collection-item-height.

I'm going to commit a fix that will make items' width and height css-wise equal their width and height in the collection repeat grid.

@ajoslin ajoslin closed this as completed in 34e350b Feb 6, 2015
@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants