[ 4 posts ]

Jim Webb

  • Username: jimwebb
  • Joined: Fri Feb 10, 2012 2:53 pm
  • Posts: 7
  • Offline
  • Profile

WidgetButtons attribute override in custom widget

Post Posted: Fri Feb 10, 2012 3:04 pm
+0-
Hi, I am building a custom widget that uses WidgetButtons extension (YUI3.5PR2). I am trying to override the default "X" button, but whatever I try has no effect. Can anyone let me what could be wrong with my code?
I also tried updating the attribute in initializer() function using this.set('buttons',[...]), which had no effect either.

Code:
YUI.add('portlet-panel', function(Y) {
  Y.PortletPanel = Y.Base.create("portlet-panel", Y.Widget, [Y.WidgetStdMod, Y.WidgetButtons], {
    ATTRS : {
      buttons: [  {
        value:'TEST',
        section: Y.WidgetStdMod.HEADER,
        action:function (e) {
          console.log('test');
        }
      } ]
    },
    initializer : function(config) {},
    renderUI: function() {},
    bindUI: function() {},
    syncUI: function() {}
  });
}, '3.5.0pr2' ,{requires:['widget',  'widget-stdmod']});

Eric Ferraiuolo

YUI Developer

  • Username: ericf
  • Joined: Mon Jan 12, 2009 8:26 pm
  • Posts: 380
  • Location: Boston, MA
  • Twitter: ericf
  • GitHub: ericf
  • Gists: ericf
  • IRC: eric_f
  • YUI Developer
  • Offline
  • Profile

Re: WidgetButtons attribute override in custom widget

Post Posted: Fri Feb 10, 2012 9:36 pm
+0-
Jim,

WidgetButtons is currently pretty broken, but luckily I've been spending some time this week rewriting it from scratch :D https://github.com/ericf/yui3/blob/widg ... buttons.js

The updated WidgetButtons will be in 3.5.0pr3.

For your current issue, are you trying to remove the default close (x) button? Or retain it but add other buttons in the Widget's header?

Jim Webb

  • Username: jimwebb
  • Joined: Fri Feb 10, 2012 2:53 pm
  • Posts: 7
  • Offline
  • Profile

Re: WidgetButtons attribute override in custom widget

Post Posted: Fri Feb 10, 2012 9:38 pm
+0-
I am trying to replace "X" button with another button at the class level.

Jim Webb

  • Username: jimwebb
  • Joined: Fri Feb 10, 2012 2:53 pm
  • Posts: 7
  • Offline
  • Profile

Re: WidgetButtons attribute override in custom widget

Post Posted: Fri Feb 10, 2012 10:01 pm
+0-
I am trying to replace the default button with another button at the widget class level. Let me know if this approach is incorrect
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum