Search code examples
extjsextjs4radio-button

How to set image as a icon in radiofield?


I have a group of radio buttons. I am not able to set image as a icon in radiofield. Here is my code :

items: [
{
    icon: 'img/rag123a.',
    name: 'rag',
    id: 'rag1',
    margin: '0 10 0 0'
}
]

Something like this I want :

enter image description here


Solution

  • Perhaps you want to show the image in the label of the radiobutton? if yes, one way to warp the image is to put it in the boxLabel as shown in this jsfiddle http://jsfiddle.net/NUPD2/

    *the source of the icon was copied from https://www.iconfinder.com/icons/40737/bar_chart_icon#size=128 in this example*

    {
                boxLabel: '<img src="url/to/image" width="20" height="20"/>',
                name: 'size',
                inputValue: 'l',
                id: 'radio2'
     }