Fix et2_button does not set image if the widget gets created via et2_createWidget

- Implement searchbox's image with image attribute
This commit is contained in:
Hadi Nategh 2016-02-16 15:23:14 +00:00
parent 23f0cbad1e
commit 9fd87f7816
2 changed files with 4 additions and 3 deletions

View File

@ -103,6 +103,7 @@ var et2_button = et2_baseWidget.extend([et2_IInput, et2_IDetachedDOM],
.attr({type:"button"}); .attr({type:"button"});
this.setDOMNode(this.btn[0]); this.setDOMNode(this.btn[0]);
} }
if (this.options.image) this.set_image(this.options.image);
}, },
/** /**

View File

@ -440,7 +440,7 @@ var et2_searchbox = et2_textbox.extend(
{ {
var self = this; var self = this;
// search button indicator // search button indicator
this.button = et2_createWidget('button',{class:"et2_button_with_image"},this); this.button = et2_createWidget('button',{image:"search","background_image":"1"},this);
this.button.onclick= function(){ this.button.onclick= function(){
self._show_hide(true); self._show_hide(true);
self.search.input.focus() self.search.input.focus()
@ -523,11 +523,11 @@ var et2_searchbox = et2_textbox.extend(
{ {
if (!this.get_value()) if (!this.get_value())
{ {
jQuery(this.button.getDOMNode()).removeClass('searched'); jQuery(this.button.getDOMNode()).removeClass('toolbar_toggled');
} }
else else
{ {
jQuery(this.button.getDOMNode()).addClass('searched'); jQuery(this.button.getDOMNode()).addClass('toolbar_toggled');
} }
}, },