hide container after triggering save event

This commit is contained in:
vitalets
2013-01-17 14:52:04 +04:00
parent b0dd701b78
commit 983d011bc7
4 changed files with 10 additions and 6 deletions

@ -243,7 +243,6 @@ Applied as jQuery method.
}, },
save: function(e, params) { save: function(e, params) {
this.hide('save');
/** /**
Fired when new value was submitted. You can use <code>$(this).data('editableContainer')</code> inside handler to access to editableContainer instance Fired when new value was submitted. You can use <code>$(this).data('editableContainer')</code> inside handler to access to editableContainer instance
@ -264,6 +263,9 @@ Applied as jQuery method.
}); });
**/ **/
this.$element.triggerHandler('save', params); this.$element.triggerHandler('save', params);
//hide must be after trigger, as saving value may require methods od plugin, applied to input
this.hide('save');
}, },
/** /**

@ -38,12 +38,14 @@
innerHide: function () { innerHide: function () {
this.$tip.hide(this.options.anim, $.proxy(function() { this.$tip.hide(this.options.anim, $.proxy(function() {
this.$element.show(); this.$element.show();
this.tip().empty().remove(); this.innerDestroy();
}, this)); }, this));
}, },
innerDestroy: function() { innerDestroy: function() {
this.tip().remove(); if(this.tip()) {
this.tip().empty().remove();
}
} }
}); });

@ -133,8 +133,8 @@ Makes editable any HTML element on the page. Applied as jQuery method.
return; return;
} }
//if it is input with source, we pass callback in third param to be called when source is loaded //if input has `value2htmlFinal` method, we pass callback in third param to be called when source is loaded
if(this.input.options.hasOwnProperty('source')) { if(this.input.value2htmlFinal) {
return this.input.value2html(this.value, this.$element[0], this.options.display, response); return this.input.value2html(this.value, this.$element[0], this.options.display, response);
//if display method defined --> use it //if display method defined --> use it
} else if(typeof this.options.display === 'function') { } else if(typeof this.options.display === 'function') {

@ -104,7 +104,7 @@ $(function(){
} }
text = $.isArray(text) ? text.join(this.options.viewseparator) : text; text = $.isArray(text) ? text.join(this.options.viewseparator) : text;
$(element).text(text); $(element).text(text);
}, },