[richfaces-issues] [JBoss JIRA] Commented: (RF-5512) Scrollable DataTable cannot be used when adding @charset statement to css files.

Christopher Shubert (JIRA) jira-events at lists.jboss.org
Thu Apr 9 17:04:22 EDT 2009


    [ https://jira.jboss.org/jira/browse/RF-5512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12461565#action_12461565 ] 

Christopher Shubert commented on RF-5512:
-----------------------------------------

This happens for any CSS @ rule.  The problem manifests on FireFox 3, but not on IE 6.

The problem is in the Utils.js file associated with ScrollableDataTable.  The function Utils.getrule() is the cause of the problem.  I have included a reference version of the function (from the 3.3.0 release) below.

On line 7, a reference is made to rules[i].selectorText.  This member does not apply to type 2 rules (@ rules), so any @ rule in any associated CSS will cause this method to fail.  That will result in the placement of headers and frozen columns failing for ScrollableDataTable.

A proposed fix is to modify line 7 of the getRule function to read:

 7 			if (rules[i].type == 1 && rules[i].selectorText.toLowerCase() == (className.toLowerCase())) {

Thus avoiding references to selectorText for @ rules.

 1 Utils.getRule = function (className) {
 2 	var rule = null;
 3 	var sheets = document.styleSheets;
 4 	for (var j = 0; !rule && j < sheets.length; j++) {
 5 		var rules = sheets[j].cssRules ? sheets[j].cssRules: sheets[j].rules;
 6 		for (var i = 0; !rule && i < rules.length; i++) {
 7 			if (rules[i].selectorText.toLowerCase() == (className.toLowerCase())) {
 8 				rule = rules[i];
 9 			}
10 		}
11 	}
	return rule;			
};

> Scrollable DataTable cannot be used when adding @charset statement to css files.
> --------------------------------------------------------------------------------
>
>                 Key: RF-5512
>                 URL: https://jira.jboss.org/jira/browse/RF-5512
>             Project: RichFaces
>          Issue Type: Bug
>          Components: ScrollableDataTable
>    Affects Versions: 3.2.2
>         Environment: windows xp + glassfish v2u2 + jdk 1.6
>            Reporter: Rong Tao
>            Assignee: Konstantin Mishin
>             Fix For: Future
>
>
> This is a very strange bug, when I add a statement '@charset "utf-8"' to a css file or the css section of the xhtml file, the Scrollable DataTable becomes very strange and cannot be used, the problems are:
> 1. the table header is not displayed.
> 2. scroll bar is not displayed.
> 3. cannot select any rows.
> 4. the 1st and 2nd columns are overlap.
> Very easy to reproduce: download and deploy the demo scrollableDataTable.xhtml and DataTableScrollerBean.java; then add  '@charset "utf-8"' to scrollableDataTable.xhtml, the <style> section of the page should be like this:
> <style>
>                     @charset "utf-8";
> 			.scrolls{
> 				width:300px;
> 				height:200px;
> 				overflow:auto;
> 			}
> </style>
> Refresh the page and you will see the problems. 
> Not only "utf-8", other charset such as "iso-8859-1" can also cause the issue.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the richfaces-issues mailing list