ion-grid doesn't render inside of ion-item
Ionic version: (check one with "x") [ ] 1.x [x] 2.x
I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
ion-grid doesn't render if inside of an ion-item
Expected behavior:
I'd expect it to render correctly, or at the very least, generate an error.
Steps to reproduce:
Take a look at the plunkr below, or create a new project and copy the related code below into any of the pages.
http://plnkr.co/edit/HnwzPp3XqEyhzJYssVyz?p=preview
Related code:
<ion-content padding>
<ion-item>
<ion-label>Test label. This will appear. The grid below won't.</ion-label>
<ion-grid>
<ion-row>
<ion-col width-100>
This won't appear.
</ion-col>
</ion-row>
</ion-grid>
</ion-item>
</ion-content>
Other information:
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
Your system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.47
ios-deploy version: 1.9.0
ios-sim version: 5.0.13
OS: OS X El Capitan
Node Version: v6.9.1
Xcode version: Xcode 8.2 Build version 8C38
I don't believe this is a bug. Things inside <ion-item> require an item-* attribute as documented here.
Hello @slooker ! Quick question, what is the use case for putting a grid inside ion-item in your app?
I believe it doesn't render inside ion-card either. Should I create a custom component with the same design as a card in the future? Thanks.
Thanks for the issue! I'm not seeing any issues with the grid rendering inside of a card with the new grid system:
<ion-card>
<ion-grid>
<ion-row>
<ion-col col-12 col-sm-6 col-lg-4>
col
</ion-col>
<ion-col col-12 col-sm-6 col-lg-4>
col
</ion-col>
<ion-col col-12 col-sm-6 col-lg-4>
col
</ion-col>
</ion-row>
</ion-grid>
</ion-card>
As for the item, it does require specific elements/attributes inside of it. You can either place the content inside of the ion-label or give the grid the item-content attribute. Please see the docs for Item Placement here: http://ionicframework.com/docs/v2/api/components/item/Item/#item-placement
You can read more on our new grid system here: http://blog.ionic.io/build-awesome-desktop-apps-with-ionics-new-responsive-grid/
Thanks! :)
Hi all.. this does not work inside of an ion-card. The 3 items should be in one row but on iPH4 the 3rd item packs beneath the top 2. I have tried the col-xs-4 but it makes absolutely no difference. I have tried this within the ion-content and outside of it. Neither work. It only works within an ion-item inside the card but then I have padding issues.
I would expect the grid system to work within any ionic component - list or card.
(My copy paste seems to lose all format)
I FOUND THE SOLUTION - adding nowrap to the row.
<ion-grid>
<ion-row>
<ion-col text-center>
<button ion-button icon-left clear small>
<ion-icon name="md-alarm"></ion-icon>
<div>15:00</div>
</button>
</ion-col>
<ion-col text-center>
<button ion-button icon-left clear small>
<ion-icon name="md-calendar"></ion-icon>
<div>12 June</div>
</button>
</ion-col>
<ion-col text-center>
<button ion-button icon-left clear small>
<ion-icon name="md-pricetag"></ion-icon>
<div>R1000</div>
</button>
</ion-col>
</ion-row>
<ion-row>
<ion-col text-center >
<button ion-button outline center>Primary Outline</button>
</ion-col>
</ion-row>
</ion-grid>
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.