View Full Version : How to use an icon as "value" of "displayfield"?

7 Jan 2015, 2:58 AM
I wish to have an icon displayed as "value" for a form "displayfield". This is to display read-only values like true/false and yes/no with icons like "tick mark/cross mark". How to do it? There are many posts on labels but that is not what I am looking for. I need a "fieldLabel" and then the icon (it is not mandatory to use a form though, I may use any component for this).

7 Jan 2015, 9:48 PM
See the source for displayfield.

I think I'd try overriding getDisplayValue in a subclass. You should be able to generate whatever markup you need, then a bit of CSS and you're done.

8 Jan 2015, 2:48 AM
Finally did the following:

{ xtype: 'fieldcontainer', fieldLabel: 'Label 1', flex: 1, name: 'Name 1', items: [{ xtype: 'image', glyph: '[email protected]' }] },{ xtype: 'fieldcontainer', fieldLabel: 'Label 2', flex: 1, name: 'Name 2', items: [{ xtype: 'image', glyph: '[email protected]' }] }

12 Jan 2015, 1:16 PM
I think your approach is quite valid.