PDA

View Full Version : Set Icon For Drop Down in TBar



joefox
9 Sep 2010, 1:00 PM
Hey guys, I'm trying to create a icon image in front of the drop down in my toolbar, but just cant seem to get it, is there some trick to this?
The dropdown works fine, just the icon wont show.

in my css:
.chart_curve_edit{background-image:url(../images/chart_curve_edit.png);}
.x-btn .chart_curve_edit{background-image:url(../images/chart_curve_edit.png);}

in my layout:
text: 'Utilities',
iconCLs: 'chart_curve_edit',
menu: [items1,items2]

Condor
10 Sep 2010, 1:13 AM
1. Javascript is case sensitive:

iconCls: 'chart_curve_edit',
2. Use:

.chart_curve_edit {
background-image: url(../images/chart_curve_edit.png) !important;
}

joefox
10 Sep 2010, 8:24 AM
I have a javascript function that changes the Text and iconCls on my form on the fly.
I can change the Text but the i throw an error when trying to change the iconCls

Any ideas?

var mtr = Ext.ComponentMgr.get('spec_filter_button');
mtr.setText('CHANGED');
mtr.seticonCls('user_edit');

Condor
10 Sep 2010, 11:11 AM
Again, case sensitive.

The method is called setIconCls.

joefox
10 Sep 2010, 11:27 AM
I did try that but it get javascript error: on that line saying object dosent support this property or method

var mtr = Ext.ComponentMgr.get('admin_filter_button');
mtr.setText('CHANGED');
mtr.setIconCls('user_edit');

Condor
10 Sep 2010, 11:31 AM
OK, had a quick look at the API docs (which you could have done too!).

It's setIconClass.