Thank you Volker,
The updating of the panel must be dependent on the row object of the sheet, that means the content of the panel for each row is different. How can i tell the set-method for the panel the row object. How can i reach that? Regards, Hani -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von Volker Weber Gesendet: Freitag, 16. Oktober 2009 09:38 An: MyFaces Discussion Betreff: Re: [Tobago] dynamic panels in tc:sheet Hi Hani, 2009/10/15 Abushammala, Hani (EXTERN: FTP) <[email protected]>: > Hi all. > > I would like to create a tc:sheet as follows: > > In want add a panel to a Colmun, which has many command elements for each > row in the sheet. > I have written a method to create a panel for the row object of the sheet, > but > i need help to bind the method with jstl or java to the panel. > > JSP: > > <tc:sheet value="#{controller.objects}" id="objectSheet" var="object" > > <tc:column id="col1" sortable="false"> > <tc:out value="#{object.attribut}" id="t_out" /> > </tc:column> > <tc:column id="col2" sortable="false"> > <tc:panel binding="#{.....}" id="t_panel" /> <tc:panel binding="#{controller.cmdPanel}" id="t_panel" /> > </tc:column> > </tc:sheet> > > Controller: > public UIComponent getCmdPanel() { // important return null here and create content in setCmdPanel() return null; } // create the content of dynamic panel in the bindinsg setter // let jsf create the panel and just add content public void setCmdPanel(UIComponent panel) { // skip if this panel has already children if (!panel.getChildren().isEmpty()) { return; } FacesContext facesContext = FacesContext.getCurrentInstance(); for (int i = 0; i < ob.getImgObjects.size(); i++) { ImgObj img = ob.getImgObjects.get(i); UILinkCommand linkCommand = (UILinkCommand) ComponentUtil.createComponent(facesContext, UILinkCommand.COMPONENT_TYPE, TobagoConstants.RENDERER_TYPE_LINK, "link" + i); ComponentUtil.setStringProperty(linkCommand, TobagoConstants.ATTR_IMAGE, img.getIconUrl()); panel.getChildren().add(linkCommand); } } In jsf the getter of the binding of a component is called once at component creation at the first rendering of the view. The setter is called if the getter returns null (with a UIComponent instance created by the framework) and at every restoreView. Your sould never store the component given by the setter somewhere, at least not longer than request scope. Hope this helps, Regards, Volker > > Any suggestions? > > Regards > > Hani -- inexso - information exchange solutions GmbH Bismarckstraße 13 | 26122 Oldenburg Tel.: +49 441 4082 356 | FAX: +49 441 4082 355 | www.inexso.de

