简体   繁体   中英

Show image instead of checked state of checkbox in extjs

How to show a image (ticked image) instead of the default tick of checkbox when the user checks it?

I tried using checkedCls config, in which the image is coming but backside of the checkbox.

checkedCls: 'checkedBoxStyle'

 .checkedBoxStyle{
       background-image:url('http://www.chathamhouse.org/sites/default/files/public/images/buttons/tick-icon.png');
       background-repeat:no-repeat;
 }

jsfiddle to start.

Well, the image only changes its background position with

.x-form-cb-checked {
     background-position: 0 -13px;
}

cause the origin image looks like this:

在此输入图像描述

You should change the whole image here.

I would suggest to change the Base class and force a override

like so:

.newBase input{
    background-image:url('../resources/images/checkBox_Tick_Mark.png') !Important;
}

And in the config

...
baseCls: 'newBase',
...

see your JSFiddle (The image path is incorrect, but it should show you the trick)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM