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

Ion-picker

$
0
0

@wekas wrote:

I can’t seem to get the button role from ion-picker. I need to know if it was ‘done’ or ‘cancel’.
They data is just coming back as follows:

{data: undefined, role: undefined}
let opts: PickerOptions = {
      cssClass: 'time-picker',
      buttons: [
        {
          text: 'Cancel',
          role: 'cancel'
        },
        {
          text: 'Done',
          role: 'done'
        }
      ],
      columns: [
        {
          name: 'hour',
          options: [
            { text: '01', value: '01' },
            { text: '02', value: '02' },
            { text: '03', value: '03' },
            { text: '04', value: '04' },
            { text: '05', value: '05' },
            { text: '06', value: '06' },
            { text: '07', value: '07' },
            { text: '08', value: '08' },
            { text: '09', value: '09' },
            { text: '10', value: '10' },
            { text: '11', value: '11' },
            { text: '12', value: '12' },
            { text: '13', value: '13' },
            { text: '14', value: '14' },
            { text: '15', value: '15' },
            { text: '16', value: '16' },
            { text: '17', value: '17' },
            { text: '18', value: '18' },
            { text: '19', value: '19' },
            { text: '20', value: '20' },
            { text: '21', value: '21' },
            { text: '22', value: '22' },
            { text: '23', value: '23' },
            { text: '24', value: '24' }
          ]
        },
        {
          name: 'minute',
          options: [
            { text: '00', value: '00' },
            { text: '15', value: '15' },
            { text: '30', value: '30' },
            { text: '45', value: '45' }
          ]
        }
      ]
    };

const picker = await this.pickerCtrl.create(opts);
    picker.present();
    picker.onDidDismiss().then(async data => {
      console.log(data);
      const hour = await picker.getColumn('hour');
      const minute = await picker.getColumn('minute');
      this.onChangeFinishTime((hour.options[hour.selectedIndex].value) as number, minute.options[minute.selectedIndex].value as number);
      this.isPickerOpen = false;
    });

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49340

Latest Images

Trending Articles



Latest Images

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