View Full Version : How to give relative path of a image in background css Ext.util.CSS.createStyleSheet

19 Jun 2015, 6:34 AM
I am trying to set background image for a button using Ext.util.CSS.createStyleSheet . Below is the code snippet, i am writing this in a controller landingpage.js,but the background image is not getting called in background, I used same path for setting a image in a cell grid through same controller which is working fine;

Ext.util.CSS.createStyleSheet('.filter1{background:#BFC9D2 !important;background-image:"/app/researchInvestments/images/close-icon.bmp";}');

My Folder structure is as below


20 Jun 2015, 2:09 PM
Never a good idea to mix content display and content presentation. It is better to use css files instead of dynaically injection <style> tags in the DOM

Just use the iconCls config of a button to set the background image and the actual path should be set in a css class.

22 Jun 2015, 6:12 AM
Thanks for the help, I used "setIcon()" method to set the Background icon to the Button