EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Xiaolin on November 22, 2011, 02:30:09 AM



Title: Event handler of Panel icon
Post by: Xiaolin on November 22, 2011, 02:30:09 AM
We can show a icon on the Panel title bar by setting the iconCls property, can we set an event handler for the icon, which will be fired when clicking on the icon? Or can we add some buttons with handler to the Panel title bar?


Title: Re: Event handler of Panel icon
Post by: tslatt on November 22, 2011, 09:21:57 AM
I was going to refer you to the 'Documentation' section of the website, where there is an example of how to do this for a panel. However, I tried to implement the example and it didn't work at all. It's possible I just did something wrong, though. You should take a look and see if it helps you.

Code:
$('#p').panel({  
  width:500, 
  height:150, 
  title: 'My Panel', 
  tools: [{ 
    iconCls:'icon-add', 
    handler:function(){alert('new')} 
  },{ 
    iconCls:'icon-save' 
    handler:function(){alert('save')} 
  }] 
});   



Title: Re: Event handler of Panel icon
Post by: Xiaolin on November 22, 2011, 09:31:42 PM
Thanks tslatt. In fact, the example is trying to add 2 buttons to the Panel toolbar, not the title bar.


Title: Re: Event handler of Panel icon
Post by: alex.capurro on December 23, 2011, 01:44:25 AM
I would like to know the same thing..


Title: Re: Event handler of Panel icon
Post by: alex.capurro on December 23, 2011, 01:51:47 AM
actually the code is exactly what i needed thanks!