Code that works just fine in IE and Firefox up to version 20, is not breaking after upgrading to FireFox 21. Also, same issue is happening with Google Chrome 26.
I have narrowed it down to the .setStyle api… If I comment it out, it works fine. If I pass in “” for the styles, it works fine. Any other value causes this issue:
// Works in IE, FF 20, fails in FF 21 and Google Chrome
rulegrid.setStyle("", “”, “background-color:#fff8e2;”, “”);
// Works everywhere
rulegrid.setStyle("", “”, “”, “”);
So, obviously there is something that dhtmlxgrid.js is doing that the later versions of the browsers doesn’t like!
Unfortunately the issue cannot be reproduced locally the pointed method works well for us in FF 21, Chrome 26.
If issue still occurs - please, provide us with a complete demo where, the issue can be reconstructed.
Here you can find a tutorial: docs.dhtmlx.com/doku.php?id=othe … leted_demo
I’m hoping this will be pretty simple to figure out… I’ve isolated it down to dhtmlxgrid’s setStyle function, specifically the code segment shown below (I formatted the code for readibility):
For the IE browser, it goes down the “then” path, which works fine. For other browser types, the “else path”, which add ‘( { mystyle stuff } )’ around the style string, which throws the exception.
I’m thinking that this was necessary at one point for older browsers, but now with the latest FF (and Chrome by the way), it is throwing an exception.
for ( var i = 0; i < prefs.length; i++)
if (this.ssModifier[i]) {
if (_isIE)
document.styleSheets[0].addRule(prefs[i],
this.ssModifier[i]);
else {
document.styleSheets[0].insertRule(prefs[i]
+ (" {" + this.ssModifier[i] + " };"),
document.styleSheets[0].cssRules.length);
}
}
The exact style strings that I’m trying to use are:
var gridHeaderStyle = "font-family:Arial;font-size:11px;font-weight:bold;color:#365d9f;";
var gridBodyStyle = "font-family:Arial;font-size:11px;color:black;";
var gridSelectedCellStyle = "background-color:#fff8e2;";
var gridSelectedRowStyle = "background-color:#fff8e2; border-color:#5286c8; border-width:1px;";
Then, later in my code I apply the style when setting up the grid:
I am also on v2.6 and have DHTMLX grid failing in Firefox 21. It worked fine in Firefox 20. I have not debugged the cause yet but guessing it is the same.
Results in (FF 21): [Exception… “An invalid or illegal string was specified” code: “12” nsresult: “0x8053000c (SyntaxError)” location: “”]
Change it to:
document.styleSheets[0].insertRule(prefs[i]+ (" {" + this.ssModifier[i] + " }"), document.styleSheets[0].cssRules.length);
(removing the semicolon) seems to resolve the problem.
Results in (FF 21): Returned Integer of insertion of the rule - should work