ionic-datepicker icon indicating copy to clipboard operation
ionic-datepicker copied to clipboard

Feature request: callback on cancel

Open elewin opened this issue 8 years ago • 5 comments

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?

elewin avatar Apr 26 '16 21:04 elewin

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.

rajeshwarpatlolla avatar May 27 '16 04:05 rajeshwarpatlolla

+1

mikkilevon avatar Jul 06 '16 12:07 mikkilevon

@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();
        }
    }
});

jgerstle avatar Aug 02 '16 04:08 jgerstle

Any news on this feature?

ScutelnicuIonel avatar May 08 '17 08:05 ScutelnicuIonel

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

fgagneten avatar May 17 '17 22:05 fgagneten