[richfaces-issues] [JBoss JIRA] (RF-11948) rich:extendedDataTable generates a js-error stating this.normalPartStyle is undefined

Brian Leathem (JIRA) jira-events at lists.jboss.org
Thu Mar 22 23:43:47 EDT 2012


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

Brian Leathem commented on RF-11948:
------------------------------------

Thanks for the detailed analysis Jan, that helped a lot.

The fundamental problem here is that the _initialize_ method is not called until the page has loaded.  See:
{code:title=extendedDataTable.js, L#362}
jQuery(document).ready(jQuery.proxy(this.initialize, this));
{code}

Calling this initialize method before all the DOM objects have loaded would have negative side effects.  Similarly, advancing this one initialisation piece (the normalPartStyle) to an earlier stage would treat the symptom but not cure the problem - meaning this would come up again for some other value that was not initialzed in time.

The solution I'm proposing is to fire a "rich:ready" event when the initialisation is complete.  With this in place, the above code sample would look like:
{code}	<h:head>
		<title>JSF Test</title>		
	</h:head>

	<h:body>
		<h:form id="myForm">
			<rich:extendedDataTable id="tableA" var="item" value="#{model.tableList}" rows="5">
			<f:facet name="header">
				<h:outputText value="HeaderA" />				
			</f:facet>
			<rich:column id="colA" width="100px">
				<f:facet name="header">
					ColA
				</f:facet>
				#{item.itemA}
			</rich:column>
		</rich:extendedDataTable>
		<script type="text/javascript">
        	        jQuery(#{rich:component('capitals')}.element).bind("rich:ready", function(event, table) {
                	    table.setColumnWidth('colCapital','500');
	                });
		</script>
		</h:form>
	</h:body>
</html>
{code}

Where we register a jQuery event handler for the rich:ready event fired by the extendedDataTable.
                
> rich:extendedDataTable generates a js-error stating this.normalPartStyle is undefined
> -------------------------------------------------------------------------------------
>
>                 Key: RF-11948
>                 URL: https://issues.jboss.org/browse/RF-11948
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-tables
>    Affects Versions: 4.2.0.CR1
>         Environment: richfaces-4.2.0-SNAPSHOT, Firefox 10, IE8
>            Reporter: Rene O
>            Assignee: Brian Leathem
>             Fix For: 4.2.1.CR1
>
>
> If you use rich:extendedDataTable and manually set the width of a column afterwards, a js error occurs
> {code:title=page-snippet to reproduce the issue}
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml"
> 	  xmlns:h="http://java.sun.com/jsf/html"
> 	  xmlns:f="http://java.sun.com/jsf/core"
> 	  xmlns:ui="http://java.sun.com/jsf/facelets"
> 	  xmlns:a4j="http://richfaces.org/a4j"
> 	  xmlns:rich="http://richfaces.org/rich"	 
> 	 >
> 	<h:head>
> 		<title>JSF Test</title>		
> 	</h:head>
> 	<h:body>
> 		<h:form id="myForm">
> 			<rich:extendedDataTable id="tableA" var="item" value="#{model.tableList}" rows="5">
> 			<f:facet name="header">
> 				<h:outputText value="HeaderA" />				
> 			</f:facet>
> 			<rich:column id="colA" width="100px">
> 				<f:facet name="header">
> 					ColA
> 				</f:facet>
> 				#{item.itemA}
> 			</rich:column>
> 		</rich:extendedDataTable>
> 		<script type="text/javascript">
> 			#{rich:component('tableA')}.setColumnWidth('colA','200');
> 		</script>
> 		</h:form>
> 	</h:body>
> </html>
> {code}
> {code:title=js error}
> Fehler: this.normalPartStyle is undefined
> Quelldatei: http://localhost:8080/jsftest/javax.faces.resource/extendedDataTable.js.jsf?ln=org.richfaces
> Zeile: 279
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list