vitalets / angular-xeditable

Edit in place for AngularJS
http://vitalets.github.io/angular-xeditable
MIT License
1.91k stars 403 forks source link

Autosubmit on bsdate #420

Closed arcadeJHS closed 8 years ago

arcadeJHS commented 8 years ago

Hi, I am trying to use angular-xeditable (tag 0.1.10, forked from this repo https://github.com/mhennemeyer/angular-xeditable) together with ui-bootstrap 1.0.3 (with "uib-" prefixes).

The problem is I do not know how to manage autosubmit on a datepicker when buttons="no".

I also integrated the commit fdd5dc2 to make buttons optional.

I would like, on date selection, to close the calendar, and call $submit on field. But it does not seem to work.

I actually found a workaround by using the "focus" event on input:

autosubmit: function() {
                var self = this,
                    inputDatePicker = self.inputEl.find('input');
                inputDatePicker.bind('focus', function() {
                    setTimeout(function() {
                        self.scope.$apply(function() {
                            self.scope.$form.$submit();
                        });
                    }, 100);
                });
            }

But is it a good solution? This way the input should always be in readonly mode.

Any suggestion? Thanx!