Possible Error with subtable in primefaces 5

UI Components for JSF
Post Reply
Jgomes
Posts: 125
Joined: 13 Oct 2011, 11:30

23 Apr 2014, 14:29

With primefaces 4 work fine with 5 i HAve this error

Code: Select all

Servlet.service() for servlet Faces Servlet threw exception: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.RangeCheck(ArrayList.java:547) [classes.jar:1.6.0_65]
	at java.util.ArrayList.get(ArrayList.java:322) [classes.jar:1.6.0_65]
	at org.primefaces.component.datatable.DataTableRenderer.encodeThead(DataTableRenderer.java:706) [primefaces-5.0.RC1.jar:5.0.RC1]
	at org.primefaces.component.datatable.DataTableRenderer.encodeThead(DataTableRenderer.java:670) [primefaces-5.0.RC1.jar:5.0.RC1]
	at org.primefaces.component.datatable.DataTableRenderer.encodeRegularTable(DataTableRenderer.java:253) [primefaces-5.0.RC1.jar:5.0.RC1]
	at org.primefaces.component.datatable.DataTableRenderer.encodeMarkup(DataTableRenderer.java:217) [primefaces-5.0.RC1.jar:5.0.RC1]
	at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:83) [primefaces-5.0.RC1.jar:5.0.RC1]
my JSF Code

Code: Select all

<p:dataTable id="rolebyAgreement" var="roleAgree" value="#{mBUser.roleAgreementList}" paginator="true" rows="10" paginatorAlwaysVisible="false" paginatorPosition="bottom">  

						<f:facet name="header">  
				            <h:outputText value="#{msg.Credentials}" styleClass="headerText"/> 
				        </f:facet>
				        
				        <p:subTable var="agree" value="#{roleAgree.agreementList}">
				        	
				        	<f:facet name="header">  
				            	<h:outputText value="#{roleAgree.role.title}" styleClass="headerText"/> 
				        	</f:facet>  
		               
			                <p:column headerText="#{msg.Title}"> 
								<h:outputText value="#{agree.title}" id="title"/>  
			                </p:column>  
			  				
			                <p:column headerText="#{msg.Description}">  
			                	<h:outputText value="#{agree.description}" />  
			                </p:column> 
			                
			                <p:column headerText="#{msg.Customer}">  
			                	<h:outputText value="#{agree.customer.fullName}" />
			                </p:column>
			                
			                <p:column headerText="#{msg.Status}">  
			                    <h:outputText value="#{agree.status.code}" />
			                </p:column>
	
		                	 <p:column style="width:24px" headerText="#{msg.Details}">
				        		<p:commandButton id="selectButton"  icon="fa fa-cogs" title="View" action="#{mBAgreement.selectedAgreementCredential}" actionListener="#{optionsController.chooseLocaleFromLink}" ajax="false">
				        			<f:setPropertyActionListener value="#{agree}" target="#{mBAgreement.agreement}" />
				        			<f:setPropertyActionListener value="#{roleAgree.role.code}" target="#{mBAgreement.roleCode}" />   
				        		</p:commandButton>
				        		<p:tooltip for="selectButton" value="#{msg.View}" showEffect="clip" hideEffect="explode" />
		                	</p:column>
	                	</p:subTable>   	                 
	
		            </p:dataTable>
If I remove subtable work fine
Primefaces 5.2/5.3
Mojarra 2.1.29
Jboss AS7-WildFly 8

Jgomes
Posts: 125
Joined: 13 Oct 2011, 11:30

23 Apr 2014, 14:40

I found a solution but what this is not necessary in PF 4
my solution
in subtable at renderd tag

Code: Select all

 <p:subTable var="agree" value="#{roleAgree.agreementList}" rendered="#{roleAgree.agreementList.size() >0}">
Primefaces 5.2/5.3
Mojarra 2.1.29
Jboss AS7-WildFly 8

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

24 Apr 2014, 17:44

This issue might be fixed with along this fix https://code.google.com/p/primefaces/is ... il?id=6804.Or else we will add a condition/check when the subtable list is empty.
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

Jgomes
Posts: 125
Joined: 13 Oct 2011, 11:30

29 Apr 2014, 08:41

OK, thanks
Primefaces 5.2/5.3
Mojarra 2.1.29
Jboss AS7-WildFly 8

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 37 guests