View Full Version : setIconStyle not working after render for DataListItem still exists in version 1.0.2

12 Aug 2008, 3:15 PM
I'm using version 1.0.2, this bug is supposed to be fixed in version 1.0 RC1: http://extjs.com/deploy/gxt-1.0.2/re...se_Notes_1.0.2.

It throws NullPointerException when setIconStyle is called for DataListItem in my code, I stepped into the source code and in DataListItem.java:

public void setIconStyle(String iconStyle) {
if (rendered) {
El elem = el().selectNode("." + "x-icon-btn");
elem.replaceStyleName(this.iconStyle, iconStyle);
this.iconStyle = iconStyle;

elem is returning null.

Is there any workaround?


12 Aug 2008, 4:26 PM
If El elem = el().selectNode("." + "x-icon-btn"); is returning null they I am guessing you are using a custom template. Is that the case? If yes, you either need to override the function or add the "x-icon-btn" to your custom template. If you are not using a custom template then I do not know what the problem is. You can post some test code and I will take a look.

12 Aug 2008, 5:20 PM
In DataList's onRenderItem method there's a check for if(checkable).

Inside if(checkable) there's this fragment that will remove the x-icon-btn part of the default template.

Is checkable not longer compatible with having an icon or is this a bug?

El e = item.el().selectNode(".my-list-item-icon");
part of the default template

sb.append("<td class='{style}-icon' style='{icon}'><div class='x-icon-btn {iconStyle}'></div></td>");

12 Aug 2008, 5:49 PM
When using a check box list, you should not call setIconStyle as the check box takes the place of the icon. I have added a null check to setIconStyle and also added a iconSelector field so that the selector value can be changed as needed. Changes are in SVN.

13 Aug 2008, 9:14 AM
We are upgrading our product from mygwt. We used List and ListItem to have a checkbox and an icon. Is there any way to achieve the same thing in Ext GWT?