ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

ion-grid doesn't render inside of ion-item

Open slooker opened this issue 9 years ago • 6 comments

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

slooker avatar Dec 19 '16 02:12 slooker

I don't believe this is a bug. Things inside <ion-item> require an item-* attribute as documented here.

rapropos avatar Dec 21 '16 02:12 rapropos

Hello @slooker ! Quick question, what is the use case for putting a grid inside ion-item in your app?

jgw96 avatar Dec 21 '16 19:12 jgw96

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.

dlaynes avatar Feb 02 '17 16:02 dlaynes

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>
screen shot 2017-02-24 at 2 30 06 pm

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! :)

brandyscarney avatar Feb 24 '17 19:02 brandyscarney

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>

MichelleDiamond avatar Nov 22 '17 14:11 MichelleDiamond

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.

ionitron-bot[bot] avatar Sep 01 '18 17:09 ionitron-bot[bot]