assets/js/romo/dropdown.js in romo-0.14.3 vs assets/js/romo/dropdown.js in romo-0.14.4
- old
+ new
@@ -6,24 +6,30 @@
var RomoDropdown = function(element) {
this.elem = $(element);
this.doInitPopup();
this.romoInvoke = this.elem.romoInvoke()[0];
+ this.romoInvoke.doUnBindInvoke(); // disable auto invoke on click
- this.elem.unbind('click');
- this.elem.on('click', $.proxy(this.onToggleClick, this));
+ if (this.elem.data('romo-dropdown-disable-click-invoke') !== true) {
+ this.elem.unbind('click');
+ this.elem.on('click', $.proxy(this.onToggleClick, this));
+ }
this.elem.on('dropdown:triggerToggle', $.proxy(this.onToggleClick, this));
this.elem.on('dropdown:triggerPopupOpen', $.proxy(this.onPopupOpen, this));
this.elem.on('dropdown:triggerPopupClose', $.proxy(this.onPopupClose, this));
this.elem.on('invoke:loadStart', $.proxy(function(e, invoke) {
this.doLoadBodyStart();
+ return false;
}, this));
this.elem.on('invoke:loadSuccess', $.proxy(function(e, data, invoke) {
this.doLoadBodySuccess(data);
+ return false;
}, this));
this.elem.on('invoke:loadError', $.proxy(function(e, xhr, invoke) {
this.doLoadBodyError(xhr);
+ return false;
}, this));
this.doBindElemKeyUp();
this.doInit();
@@ -195,10 +201,15 @@
}, this), 100);
}
}
RomoDropdown.prototype.doPopupOpen = function() {
- this.romoInvoke.doInvoke();
+ if (this.elem.data('romo-dropdown-content-elem') !== undefined) {
+ this.doLoadBodySuccess($(this.elem.data('romo-dropdown-content-elem')).html())
+ } else {
+ this.romoInvoke.doInvoke();
+ }
+
this.popupElem.addClass('romo-dropdown-open');
this.doPlacePopupElem();
// bind an event to close the popup when clicking away from the
// popup. Bind on a timeout to allow time for any toggle