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

Feature request: callback on cancel #198

Open
elewin opened this issue Apr 26, 2016 · 5 comments
Open

Feature request: callback on cancel #198

elewin opened this issue Apr 26, 2016 · 5 comments

Comments

@elewin
Copy link

elewin commented Apr 26, 2016

Would it be possible to implement an option where a callback function can be run if the user clicks cancel/close without picking a date?

@rajeshwarpatlolla
Copy link
Owner

If the user didn't pick a date then we are not passing anything in to the callback . So you can check the value you are getting to the callback function and then you can decide whether the user has selected a value or not.

@mikkilevon
Copy link

+1

arturokunder added a commit to kunder-lab/ionic-datepicker that referenced this issue Jul 6, 2016
@jgerstle
Copy link

jgerstle commented Aug 2, 2016

@rajeshwarpatlolla I have a fix for this, but I need to be able to access the repo to push. If you don't want to do that you can just add this:

if(typeof $scope.mainObj.closeCallback === 'function') {
   $scope.mainObj.closeCallback();
}

after line 267 so that the code looks like this:

buttons.push({
    text: $scope.mainObj.closeLabel,
    type: 'button_close',
    onTap: function (e) {
    console.log('ionic-datepicker popup closed.');
        if(typeof $scope.mainObj.closeCallback === 'function') {
            $scope.mainObj.closeCallback();
        }
    }
});

@ScutelnicuIonel
Copy link

Any news on this feature?

@fgagneten
Copy link

Please @rajeshwarpatlolla , accept @jgerstle changes, so we can handle callback cancel, also this change helps us to solve issue #317 and #207

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants