jdkealy
jdkealy

Reputation: 4907

swapStyleSheet in extjs using absolute path

I am using multiple namespaces in my application and I would like to be able to use the same stylesheet in different parts of my app. When I load an extjs app in my root route ("/"), and I call the following method

Ext.util.CSS.swapStyleSheet("theme","/ext-4.1.1a/resources/css/ext-all-access.css");

, extjs appropriately will load the stylesheet at:

/ext-4.1.1a/resources/css/ext-all-access.css

However if I am loading my extjs app from inside a view at "/admin/pages", extjs will attempt to load my stylesheet at

/admin/ext-4.1.1a/resources/css/ext-all-access.css

Any idea how to get around this?

Upvotes: 0

Views: 767

Answers (1)

CD..
CD..

Reputation: 74166

You can try passing the full url, like:

Ext.util.CSS.swapStyleSheet("theme", window.location.origin + "/ext-4.1.1a/resources/css/ext-all-access.css");

Upvotes: 1

Related Questions