Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48979

Make first item in dynamic radio group checked on m

$
0
0

Hi, I want to have the first item of this radio group checked on load. The radio group gets created dynamically.

          <ion-radio-group id= 'radio-group' mode='ios' value='chairs' @ionChange='changeColor'>
            <ion-item v-for='chair in chairs' v-bind:key='chair.name' lines='none'>
              <ion-label v-if="chair.type == 'AUWR'" style="color:#CACACC;  line-height: 24px; font-size: 16px; letter-spacing: -0.25px;">{{chair.name}} <span>{{showMetric ? inchesToMetric(chair.size) + 'cm' : chair.size + '"'}}</span></ion-label>
              <ion-label v-if="chair.type == 'OWR'" style="color:#CACACC;  line-height: 24px; font-size: 16px; letter-spacing: -0.25px;">{{chair.name}}</ion-label>
              <ion-radio slot='start' v-model='chair.name' @click='onClickRadio(chair.size, chair.type)'></ion-radio>
            </ion-item>
          </ion-radio-group>
  ionViewWillEnter() {
    const radioGroup = document.getElementById('radio-group');
    radioGroup.childNodes[1].childNodes[2].checked = true;
  }

The code I put in ionViewWillEnter() doesn’t make it checked.

image

www should be checked. What is aria-checked is that what I should be setting?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48979

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>