diff --git a/src/containers/editable-container.js b/src/containers/editable-container.js index 9126688..83cd56f 100644 --- a/src/containers/editable-container.js +++ b/src/containers/editable-container.js @@ -243,7 +243,6 @@ Applied as jQuery method. }, 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 @@ -264,6 +263,9 @@ Applied as jQuery method. }); **/ this.$element.triggerHandler('save', params); + + //hide must be after trigger, as saving value may require methods od plugin, applied to input + this.hide('save'); }, /** diff --git a/src/containers/editable-inline.js b/src/containers/editable-inline.js index cd1268e..3a75bbe 100644 --- a/src/containers/editable-inline.js +++ b/src/containers/editable-inline.js @@ -38,12 +38,14 @@ innerHide: function () { this.$tip.hide(this.options.anim, $.proxy(function() { this.$element.show(); - this.tip().empty().remove(); + this.innerDestroy(); }, this)); }, innerDestroy: function() { - this.tip().remove(); + if(this.tip()) { + this.tip().empty().remove(); + } } }); diff --git a/src/element/editable-element.js b/src/element/editable-element.js index 00e13c6..0849836 100644 --- a/src/element/editable-element.js +++ b/src/element/editable-element.js @@ -133,8 +133,8 @@ Makes editable any HTML element on the page. Applied as jQuery method. return; } - //if it is input with source, we pass callback in third param to be called when source is loaded - if(this.input.options.hasOwnProperty('source')) { + //if input has `value2htmlFinal` method, we pass callback in third param to be called when source is loaded + if(this.input.value2htmlFinal) { return this.input.value2html(this.value, this.$element[0], this.options.display, response); //if display method defined --> use it } else if(typeof this.options.display === 'function') { diff --git a/src/inputs/select2/select2.js b/src/inputs/select2/select2.js index e338038..03e7def 100644 --- a/src/inputs/select2/select2.js +++ b/src/inputs/select2/select2.js @@ -104,7 +104,7 @@ $(function(){ } text = $.isArray(text) ? text.join(this.options.viewseparator) : text; - + $(element).text(text); },