You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by jo11 <jo...@infosys.com> on 2008/08/01 14:30:17 UTC

problem with image rendering

Hi,

We have a data table with sortable header.But we have our own implementation
for the sortable headers.
We are putting it in facelets and the content is like

<ui:composition>
        <h:commandLink
actionListener="#{paginationBean.getSortedColumnList}"
value="#{columnHeader}" styleClass="#{styleClass}">
		<f:param name="columnName" value="#{columnParam}" />
        <h:graphicImage	id="#{columnParam}"  rendered="false"
immediate="true" style="border:none;padding:4px;" />			 		
  		</h:commandLink>		
</ui:composition>

When the user is clicks on the second header after he has clicked the first
one, the first header image should disappear.To achieve this we keep a
handle of the previous image in the session and when the user clicks on a
new header we set the old image component's rendered property to false .
This logic used to work fine in icefaces as the image objects always remain
the same.But in myfaces its not working as the objects are different and
they are taking the state of the previous object.

The code snippet that gets invoked on click of a header is given below

	List childrenList = event.getComponent().getChildren();
		Iterator it = (Iterator) childrenList.iterator();
		while (it.hasNext()) {
			UIComponent comp = (UIComponent) it.next();
			if (comp instanceof HtmlGraphicImage) {
				HtmlGraphicImage image = (HtmlGraphicImage) comp;
				if (getOldImageComponent() != null && getOldImageComponent() != image) {		
					getOldImageComponent().setRendered(false);
				
				}
				image.setRendered(true);
				getPaginationBeanState().setOldImageComponent(image);


Can someone provide any workaround for the issue?

Thanks in advance...


-- 
View this message in context: http://www.nabble.com/problem-with-image-rendering-tp18773409p18773409.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.