ion-picker does not display columns in ionic 7.2.0

Discussão em 'Angular' iniciado por Gustavo Gr, Dezembro 18, 2024.

  1. Gustavo Gr

    Gustavo Gr Guest

    I'm using ion-picker in my ionic v7.2.0 project but it doesn't show the columns, only an empty gray rectangle is shown in my page, so I guess it's not consuming the columns of my ts.

    I have already visited the official ionic documentation and copied the test examples for angular, but still the picker does not show the options.

    <ion-picker
    [isOpen]="isPickerOpen"
    [columns]="pickerColumns"
    [buttons]="pickerButtons"
    (didDismiss)="setOpen(false)">
    </ion-picker>


    My page:

    import { Component } from '@angular/core';

    @Component({
    selector: 'app-home',
    templateUrl: 'home.page.html',
    styleUrls: ['home.page.scss'],
    })
    export class HomePage {
    isPickerOpen = false;

    public pickerColumns = [
    {
    name: 'col1',
    options: [
    { text: 'Opción 1', value: '1' },
    { text: 'Opción 2', value: '2' },
    { text: 'Opción 3', value: '3' }
    ]
    }
    ];

    public pickerButtons = [
    {
    text: 'Cancel',
    role: 'cancel',
    },
    {
    text: 'Confirm',
    handler: (value: any) => {
    console.log('Selected value:', value);
    // Verificar la estructura exacta del valor
    },
    },
    ];

    setOpen(isOpen: boolean) {
    this.isPickerOpen = isOpen;
    }
    }


    someone who can help me please

    Continue reading...

Compartilhe esta Página