Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v4.0.0-beta.13] ion-datetime PickerOptions interface requires columns key #16095

Closed
simonhaenisch opened this issue Oct 25, 2018 · 1 comment · Fixed by #16101

Comments

@simonhaenisch
Copy link
Contributor

commented Oct 25, 2018

Bug Report

Ionic Info

"@ionic/core": "4.0.0-beta.13"

Describe the Bug

When setting the picker options for an ion-datetime, the PickerOptions interface requires a columns key, which is actually not required according to the examples:

var customPickerButtons = {
buttons: [{
text: 'Save',
handler: () => console.log('Clicked Save!')
}, {
text: 'Log',
handler: () => {
console.log('Clicked Log. Don\'t Dismiss.');
return false;
}
}]
}
var customPickerOptions = document.getElementById('customPickerOptions');
customPickerOptions.pickerOptions = customPickerButtons;

Related Code

<ion-datetime
  pickerOptions={{
    buttons: [{ text: 'Cancel' }, { text: 'Done', handler: console.log }],
  }}
/>

Type '{ buttons: ({ text: string; } | { text: string; handler: (val: any) => void; })[]; }' is not assignable to type 'PickerOptions'.
Property 'columns' is missing in type '{ buttons: ({ text: string; } | { text: string; handler: (val: any) => void; })[]; }'.

Interface comes from here:

export interface PickerOptions {
columns: PickerColumn[];
buttons?: PickerButton[];
cssClass?: string | string[];
backdropDismiss?: boolean;
animated?: boolean;
mode?: string;
keyboardClose?: boolean;
id?: string;
enterAnimation?: AnimationBuilder;
leaveAnimation?: AnimationBuilder;
}

Expected Behavior

Maybe change it to columns?: PickerColumn[]?

Additional Context

As a workaround, one can either add an empty columns array or set the options type to any (but using the latter means losing intellisense):

<ion-datetime
  pickerOptions={{
    buttons: [{ text: 'Cancel' }, { text: 'Done', handler: console.log }],
    columns: [],
  }}
/>
<ion-datetime
  pickerOptions={
    {
      buttons: [{ text: 'Cancel' }, { text: 'Done', handler: console.log }],
    } as any
  }
/>

@ionitron-bot ionitron-bot bot added the triage label Oct 25, 2018

manucorporat added a commit that referenced this issue Oct 26, 2018

@manucorporat manucorporat added this to Backlog 🤖 in Ionic Core via automation Oct 26, 2018

@ionitron-bot ionitron-bot bot removed the triage label Oct 26, 2018

@manucorporat manucorporat self-assigned this Oct 26, 2018

Ionic Core automation moved this from Backlog 🤖 to Done 🎉 Oct 26, 2018

manucorporat added a commit that referenced this issue Oct 26, 2018
@ionitron-bot

This comment has been minimized.

Copy link

commented Nov 25, 2018

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 ionitron-bot bot locked and limited conversation to collaborators Nov 25, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
2 participants
You can’t perform that action at this time.