voyent
refresh problems with panelSeries nested in dataTable  XML
Forum Index -> Components
Author Message
paolo.politi

Joined: 15/Nov/2006 00:00:00
Messages: 8
Offline


Hi,
I'm trying to display objects stored in a two levels list:
the outer list contains objects formed by an int[] array and an inner list. The inner list objects are contains only simple types as int double and String.
The problem is that while the int[] array always gets refreshed, the inner list objects never do.
The JSP code follows:

<ice:panelTab label="#{messages['view.month']}">
<ice:dataTable var="week" value="#{viewManager.monthActivities}" width="800px" rows="0" frame="border" rules="all" cellpadding="0" partialSubmit="true">
<ice:column>
<f:facet name="header">
<ice:outputText value="#{messages['week.monday']}"/>
</f:facet>
<center>
<ice:panelGrid frame="below" columns="1">
<ice:outputText value="#{week.weekdays[0]}"/>
</ice:panelGrid>
</center>
<ice:panelSeries var="mondayActivity" value="#{week.mondayActivities}" rows="1" partialSubmit="true">
<ice:panelGroup>
<ice:panelGrid frame="box" columns="2">
<ice:commandLink value="x" action="#{activityManager.deleteActivity}">
<f:param name="delenda" value="#{mondayActivity.id}"/>
</ice:commandLink>
<ice:outputText value="#{mondayActivity.subtype}"/>
</ice:panelGrid>
</ice:panelGroup>
</ice:panelSeries>
</ice:column>
<ice:column>
<f:facet name="header">
<ice:outputText value="#{messages['week.tuesday']}"/>
</f:facet>
<center>
<ice:panelGrid frame="below" columns="1">
<ice:outputText value="#{week.weekdays[1]}"/>
</ice:panelGrid>
</center>
<ice:panelSeries var="tuesdayActivity" value="#{week.tuesdayActivities}" rows="1" partialSubmit="true">
<ice:panelGroup>
<ice:panelGrid frame="box" columns="2">
<ice:commandLink value="x" action="#{activityManager.deleteActivity}">
<f:param name="delenda" value="#{tuesdayActivity.id}"/>
</ice:commandLink>
<ice:outputText value="#{tuesdayActivity.name}"/>
</ice:panelGrid>
</ice:panelGroup>
</ice:panelSeries>
</ice:column>
( ... )

This is the Java code where the lists are updated:
public void buildMonthActivities() {
Date[] month = TimeUtil.getMonthByDate(currentDate);
List<Activity> list = filterActivitiesByRange(activities, month[0], month[month.length -1]);
logger.info(activities.size());
logger.info(list.size());
List<WeekActivities> result = new ArrayList<WeekActivities>();
for (int i = 0; i < month.length/7; i++) {
result.add(new WeekActivities(
TimeUtil.getDaysByDate(new Date[] {month[i*7], month[i*7+1], month[i*7+2], month[i*7+3], month[i*7+4], month[i*7+5], month[i*7+6]}),
filterActivitiesByDate(list, month[i*7]),
filterActivitiesByDate(list, month[i*7+1]),
filterActivitiesByDate(list, month[i*7+2]),
filterActivitiesByDate(list, month[i*7+3]),
filterActivitiesByDate(list, month[i*7+4]),
filterActivitiesByDate(list, month[i*7+5]),
filterActivitiesByDate(list, month[i*7+6])
));
}
setMonthActivities(result);
}

Thanks in advance

Paolo
ibanhoe

Joined: 12/Apr/2007 00:00:00
Messages: 71
Offline


i have a similar problem

did you resolve your problem?

i have an outter datatable, and this works fine, but i have an inner datatable too, and this inner datatable does not refresh, i have to presse "Refresh" button o the navigator to see the changes


Any idea??


Thank you very much

parulkundra

Joined: 08/May/2007 00:00:00
Messages: 2
Offline


I am also facing the same problem. If you have solved the issue, please post the solution. Thanks
ibanhoe

Joined: 12/Apr/2007 00:00:00
Messages: 71
Offline


Hi

I dont know if into the new version this issue was fixed, but my workaround is easy

my inner datatable has a few records, and i decided put one atributte into my backing bean, i fill this atributte with the html code of my table, and i binding to a jsp component

Code:
 private void preparaTablaLineas() {
 		tablaLineas = "<br /><span class=\"texto_basico\">"
 				+ "Estos son los nĂºmeros asociados al Usuario: </span>"
 				+ "<br/><br/>";
 		tablaLineas += "<center><table>";
 
 		for (int i = 0, maxi = lineas.size(); i < maxi; i++) {
 			Linea l = (Linea) lineas.get(i);
 
 			tablaLineas += "<tr>";
 
 			tablaLineas += "<td>";
 			tablaLineas += "<img src='" + l.getIcon() + "'/>";
 			tablaLineas += "</td>";
 
 			tablaLineas += "<td class='texto_basico_resaltado'>";
 			tablaLineas += l.getNumero();
 			tablaLineas += "</td>";
 
 			tablaLineas += "</tr>";
 		}
 
 		tablaLineas += "</table></center>";
 	}
 


tablaLineas is my attribute



this is my jsp code

Code:
 <!-- Tabla de lineas -->
 
 														<ice:outputText escape="false" value="#{usuario.tablaLineas}" rendered="#{usuario.expanded}" />
 



this is all

i hope this helps
parulkundra

Joined: 08/May/2007 00:00:00
Messages: 2
Offline


thanks for your help. I will try to implement your fix in my page. fyi, I am using icefaces 1.6.1 and the problem still exists.
dkohl

Joined: 02/Jun/2007 00:00:00
Messages: 13
Offline


Here the solution:

a) Create a new class for the surrounding UISeries (datatable, panelseries...). The field we've to reset is protected.
b) Create a "forceRefresh"-method with the following code:

Code:
 	public void forceRefresh() {
 		savedChildren.clear();
 	}
 


c) Create binding for this UISeries.
d) Call this method before the new page is rendered (e.g. when a button is pressed).

For me it works really fine and seems to be an elegant workaround for this problem.

Greetings

Daniel
pred


Joined: 09/Jul/2007 00:00:00
Messages: 87
Offline


I hope this issue will be fixed soon :( I experienced the same trouble in simple panelSeries .

- Stephane Maldini
tlecouffe

Joined: 18/Nov/2008 00:00:00
Messages: 18
Offline


Ok... I felt I needed to post a solution that worked for me in my challenge to refresh fields in nested panelSeries components. Spoiler: it's all about the bindings!

The problem was displaying a catalogue with a
1-many-many model.


Here's the xhtml to start:

Code:
 <ice:form id="myId">
 	
 				<ui:repeat var="parentCat" value="#{pc_View.catalogue.pysParentCat}">
 					<center>
 					
 					<ice:panelGroup style="width: 730px;float:left">	
 						<ice:outputText value="#{parentCat.parentName}" styleClass="catalogue"/>	
 					</ice:panelGroup>			
 							
 							<ice:panelSeries var="category" value="#{parentCat.pysCategories}" id="catId" style="float:left" binding="#{pc_View.categoryPanel}"> 							
 									<ice:panelGroup style="width: 325px;float:left">										
 										<ice:panelGrid style="width: 425px">										
 											<ice:outputText value="#{category.catName}" style="float:left" styleClass="catalogue"/>
 											
 											<ice:panelGroup style="width: 425px;float:left" styleClass="catalogue">	
 												<ice:outputText value="Item" style="float:left; margin: 0px 10px 0px 0px; width: 140px;" styleClass="catalogue"/>
 												<ice:outputText value="Value" style="float:left; margin: 0px 15px 0px 0px" styleClass="catalogue"/>
 												<ice:outputText value="Quantity" style="float:left; margin: 0px 10px 0px 5px" styleClass="catalogue"/>
 												<ice:outputText value="Total" style="float:left; margin: 0px 0px 10px 0px" styleClass="catalogue"/>
 											</ice:panelGroup>
 																						
 											<ice:panelSeries var="product" value="#{category.pysProducts}" id="catId" style="float:left" binding="#{pc_View.productPanel}">
 											<ice:panelGroup>										
 												<ice:panelGroup style="width: 325px;float:left">
 												<ice:panelGrid columns="4" columnClasses="" border="0">														
 													<ice:outputText value="#{product.prdName}" style="float:left; margin: 0px 0px 0px 0px; width: 140px;" styleClass="catalogue"/>
 													<ice:outputText value="#{product.prdPrice}" style="width: 50px; text-align: left; float:left; margin: 0px 0px 0px 0px" styleClass="catalogue" >
 													<f:convertNumber minFractionDigits="2" maxFractionDigits="2"/>
 													</ice:outputText>
 													<ice:inputText id="quantityId" immediate="true" partialSubmit="true" valueChangeListener="#{pc_View.handleProductQuantityValueChangeEvent}" 
 													binding="#{pc_View.quantityInputText}" onchange="this.form.submit(this);" value="#{product.quantity}" size="3" style="float:left; margin: 0px 10px 0px 5px">
 														<f:attribute name="changeField" value="#{product.quantity}"/>
 														
 													</ice:inputText>
 													
 													<ice:inputText id="totalId" value="#{product.total}" size="3" 
 														binding="#{pc_View.totalInputText}"
 														style="float:left; margin: 0px 10px 0px 0px">
 														
 														</ice:inputText>	
 												</ice:panelGrid>													
 												</ice:panelGroup>
 											</ice:panelGroup>											
 											</ice:panelSeries>
 										</ice:panelGrid>
 									</ice:panelGroup>	
 										                  					                  	
 							</ice:panelSeries>
 						
 					</center>									
 				</ui:repeat>
 				
 				</ice:form> 
 



and the Bean:

Code:
 public void handleProductQuantityValueChangeEvent(ValueChangeEvent vce)
 	{
 		//do calculations/update stuff...
 		.
 		.
 		//update the bindings!!
 		quantityInputText.updateModel(getFacesContext());
 		totalInputText.updateModel(getFacesContext());
 	}
 	
 	
 	
 	private PanelSeries productPanel;
 	private PanelSeries categoryPanel;
 
 	public PanelSeries getProductPanel() {
 		return productPanel;
 	}
 	public void setProductPanel(PanelSeries productPanel) {
 		this.productPanel = productPanel;
 	}
 	public PanelSeries getCategoryPanel() {
 		return categoryPanel;
 	}
 	public void setCategoryPanel(PanelSeries categoryPanel) {
 		this.categoryPanel = categoryPanel;
 	}
 	
 	private HtmlInputText quantityInputText;
 	private HtmlInputText totalInputText;
 	
 	public HtmlInputText getQuantityInputText() {
 		return quantityInputText;
 	}
 	public void setQuantityInputText(HtmlInputText quantityInputText) {
 		this.quantityInputText = quantityInputText;
 	}
 	public HtmlInputText getTotalInputText() {
 		return totalInputText;
 	}
 	public void setTotalInputText(HtmlInputText totalInputText) {
 		this.totalInputText = totalInputText;
 	}
 
 


Note:
the forceRefresh on the panelSeries does not work because with the lists in my setup, clearing them can alter the order (I assume.. it produces odd behavior). I imagine there are cases for it.

I also found that putting Code:
immediate="true" partialSubmit="true"
on my input component was necessary.

Anyways,
Hope that helps!!


karthik1516

Joined: 14/Apr/2008 00:00:00
Messages: 1
Offline


dkohl wrote:
Here the solution:

a) Create a new class for the surrounding UISeries (datatable, panelseries...). The field we've to reset is protected.
b) Create a "forceRefresh"-method with the following code:

Code:
 	public void forceRefresh() {
 		savedChildren.clear();
 	}
 


c) Create binding for this UISeries.
d) Call this method before the new page is rendered (e.g. when a button is pressed).

For me it works really fine and seems to be an elegant workaround for this problem.

Greetings

Daniel  


What do you mean by surrounding? Do you mean extending? If I create a custom UISeries extended from UISeries, I can not bind to a panel series. I get type mismatch error.
 
Forum Index -> Components
Go to:   
Powered by JForum 2.1.7ice © JForum Team