PDA

View Full Version : Error trying to use function of Ext.util.CSS



michielh
13 Nov 2013, 6:44 AM
I have a construction where I generate a set of styles, and to toggle those styles (which are applied to a lot of different parts in the application, I try to remove the set of styles. But when i do, the function removeStyleSheet gives an error. Other functions like addRule also give this error. Could this be a bug?
The showChanges call is called when the panel activates and the rules do appear.

Ext 4.2


hideChanges: function (button) {
"use strict";
Ext.util.CSS.removeStyleSheet("changesStyles");
},
showChanges: function (button) {
"use strict";
Ext.util.CSS.createStyleSheet(
" .changed_cell {" +
" background-color : #fefe98 !important;" +
" color : #000 !important;" +
" } " +
" .deleted_cell {" +
" background-color : #FFD1D0 !important;" +
" color : #000 !important;" +
" } " +
" .added_cell {" +
" background-color : #BFE8BE !important;" +
" color : #000 !important;" +
" }",
"changesStyles"
);
},

When the hideChanges is called I get


Uncaught TypeError: Cannot call method 'apply' of undefined

Please help!

Gary Schlosberg
14 Nov 2013, 10:05 PM
Haven't heard of an issue with removeStyleSheet. Seems the style is not defined. Are you seeing this in ExtJS 4.2.1? Can you post more of your code?

michielh
17 Nov 2013, 2:26 PM
Well, there is a huge application, but no use at all of any special CSS functionality.
The showChanges function is called when the panel this controller is for is being activated, and that works.
I verified the Ext version 4.2.1 by checking the ext-all.js file in the brower.

michielh
18 Nov 2013, 12:56 AM
It turns out to be a typo in the controller assignments so the event would not have a function.