[Common] Change setVisible, isVisible methods for Button component.

This commit is contained in:
Julia Radzhabova 2017-11-16 12:37:41 +03:00
parent 4dbb667254
commit 1b26f5a94d

View file

@ -180,7 +180,8 @@ define([
menu : null, menu : null,
disabled : false, disabled : false,
pressed : false, pressed : false,
split : false split : false,
visible : true
}, },
template: _.template([ template: _.template([
@ -238,6 +239,7 @@ define([
me.split = me.options.split; me.split = me.options.split;
me.toggleGroup = me.options.toggleGroup; me.toggleGroup = me.options.toggleGroup;
me.disabled = me.options.disabled; me.disabled = me.options.disabled;
me.visible = me.options.visible;
me.pressed = me.options.pressed; me.pressed = me.options.pressed;
me.caption = me.options.caption; me.caption = me.options.caption;
me.template = me.options.template || me.template; me.template = me.options.template || me.template;
@ -466,6 +468,10 @@ define([
me.setDisabled(!(me.disabled=false)); me.setDisabled(!(me.disabled=false));
} }
if (!me.visible) {
me.setVisible(me.visible);
}
me.trigger('render:after', me); me.trigger('render:after', me);
return this; return this;
@ -550,6 +556,11 @@ define([
setVisible: function(visible) { setVisible: function(visible) {
if (this.cmpEl) this.cmpEl.toggleClass('hidden', !visible); if (this.cmpEl) this.cmpEl.toggleClass('hidden', !visible);
this.visible = visible;
},
isVisible: function() {
return (this.cmpEl) ? this.cmpEl.is(":visible") : $(this.el).is(":visible");
}, },
updateHint: function(hint) { updateHint: function(hint) {