@donotsue wrote:
Hi there,
on Ionic 4 I’m trying to preselect items on the
<ion-picker>
before it shows up.Following code shows the regular way of creating and showing up the picker (it’s allmost the same way like the AlertController).
import { PickerController } from '@ionic/angular'; constructor(private pickerCtrl: PickerController) {} ... const pickerCtrl = await this.pickerCtrl.create({ ... columns: [ { name: 'myColumn', options: [ { text: 'A', value: 'A', selected: false }, { text: 'B', value: 'B', selected: true } ] }, ... ] ... await pickerCtrl.present(); });
There you can see, I initialize the columns with the B-item preselected. But when the picker shows up, the A-item got the
selected: true
and the B-item changed toselected: false
. Even setting the selected-properties of the items AFTER creation and shownes of the picker it still does not change the selection. Every time the picker starts with the first column items.Please … how do I accomplish the preselection of an ion-picker?
Posts: 1
Participants: 1