View Full Version : displaying a badge on arbitrary elements (non-components)

9 Jan 2012, 10:57 AM
Hi all,

I have seen the convenient way to set badge text on components using a setBadge method.

I need a way to create a badge for non-components. Basically I have a DataView that creates an icon grid from store data. That works fine. But I want to be able to show a badge on some of those icons which are just dom elements. In looking at the generated source, I see that the dataview does not create actual ext components of each of the items, so doesn't seem like there is a setBadge method for me to call on a given item. I tried to do it manually, by setting the class 'x-badge' on one of my divs, but it didn't have any effect.

Any help is appreciated.

9 Jan 2012, 11:04 AM
In your template, create a <div> that is positioned where you want it and with the text you want.

9 Jan 2012, 11:46 AM
Thanks for the reply. OK, so seems that I'll need to do it manually in the template; easy enough. Is there a css class that I can apply to the div so that it stays consistent in appearance with the badge added by setBadge?

9 Jan 2012, 11:56 AM
I would forget about the badge, most likely you will need to write your own CSS