-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
DateTime doesn't allow adding Picker buttons or Clearing Value #7333
Comments
Hello, thanks for opening an issue with us! Would you be able to provide a plunker that demonstrates this issue? Thanks for using Ionic! |
See example here. http://plnkr.co/edit/Xm0yw3UpxAIi8NSEzyIV?p=preview Note my |
The problem lies in line 479 of the datetime.ts where pickerOptions.buttons get overwritten by [Cancel, OK] (https://github.com/driftyco/ionic/blob/master/src/components/datetime/datetime.ts#L479) |
How is the status of this issue? I would like to use the Also note that See https://github.com/driftyco/ionic/blob/master/src/components/datetime/datetime.ts#L485 |
Any news? Would like to have an clear value option to datetime |
Hi we need only a var /* @type {?} / pickerOptions = Object.assign({}, this.pickerOptions); |
(Psst, having Pull Requests already there makes it a lot easier to just merge this some time together with other stuff) |
@brandyscarney How can an |
@Simpler1 The handler function was not being copied/called using our <ion-datetime pickerFormat="YYYY-MM-DDThh:mm" [pickerOptions]="customOptions" [(ngModel)]="placeholderDate" placeholder="Select Date"></ion-datetime> customOptions: any = {
buttons: [{
text: 'Save',
handler: () => console.log('Clicked Save!')
}, {
text: 'Clear',
handler: () => {
this.placeholderDate = null;
}
}]
}; |
@brandyscarney Thanks. That's exactly what I was looking for. |
@brandyscarney I'm new in Ionic 3 and a bit confused, My package.json dependencies looks like
[email protected] is the latest but my handler function not get called
I don't think that I've got the recent changes you did. Please Help |
@IshaqBhojaniGenetech The PR that was merged to fix that issue will be in the There is a nightly released here if you'd like to try it out sooner:
|
Thanks @brandyscarney that worked. Can you please look into this Issue. |
@IshaqBhojaniGenetech Thank you! I pushed a fix for this and released a nightly:
We plan on releasing a |
Here is an another solution. Hope someone will get help from the solution: |
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. |
I'm trying to utilize the DateTime component, but need a way to allow the user to "clear" the field (i.e. remove the value). The DateTime API docs mention that you can pass in the
pickerOptions
, but when I try to pass in an array of buttons, I see that they're overwritten with the default Done/Cancel butttonsYou can see in datetime.ts that the
buttons
property is overwritten during instantiation, just after it was merged with thepickerOptions
that were sent in.Is there a suggested approach for removing the value from one of these DateTime controls?
The text was updated successfully, but these errors were encountered: