Browse files

Added seticon method to button

  • Loading branch information...
1 parent ae45207 commit f4e2e97e1bca4ee771f6780b9ad79138d14953fa @hofmeister committed Feb 4, 2014
Showing with 15 additions and 0 deletions.
  1. +15 −0 js/lib/widget.js
View
15 js/lib/widget.js
@@ -1798,6 +1798,21 @@ $wb.ui.Button = $wb.Class('Button', {
this.elm().bind('click', this.opts.action);
}
},
+ setIcon: function( newIcon ) {
+ if (!newIcon) {
+ this.iconElm().remove();
+ return;
+ }
+
+ newIcon.addClass(this.opts.iconClass);
+ var oldIcon = this.iconElm();
+ if (oldIcon.length > 0) {
+ oldIcon.before(newIcon);
+ oldIcon.remove();
+ } else {
+ this.target().prepend(newIcon);
+ }
+ },
title: function () {
if (arguments.length > 0) {
this.titleElm().html(arguments[0]);

0 comments on commit f4e2e97

Please sign in to comment.