Dynamic HtmlDataTable inside modalPanel
leiras Apr 30, 2008 11:10 AMHi,
i want to show a HtmlDataTable inside a modal panel.
Take a look at a piece of my code:
jsp
<rich:modalPanel id="mpProtocoloSanitario" autosized="true" > <h:form> <h:outputText value="Protocolo Sanitário"/> <rich:panel id="pnProtocoloSanitario" binding="#{rastreador.panelProtocoloSanitario}" /> <rich:panel style="text-align:center;margin-left: auto;margin-right: auto; margin-top: auto; margin-bottom: auto; border-width: 0px 0px 0px 0px; height: 30px;background-color: transparent;" > <h:graphicImage url="/imagens/bt_fechar.png" style="cursor: hand; cursor: pointer; margin-top: 10px;" onclick="javascript:Richfaces.hideModalPanel('mpProtocoloSanitario')" /> </rich:panel> </h:form> </rich:modalPanel>
java
private void atualizarPanelProtocoloSanitario(HtmlPanel panel, Long idElo) { if (panel == null) { panel = new HtmlPanel(); } else { panel.getChildren().clear(); } this.setDefensivosPropriedade(this.obterDefensivosPropriedade(idElo)); Application app = FacesContext.getCurrentInstance().getApplication(); org.richfaces.component.html.HtmlDataTable tbPS = new org.richfaces.component.html.HtmlDataTable(); tbPS.setValueBinding("value", app.createValueBinding("#{rastreador.defensivosPropriedade}")); tbPS.setRendered(true); tbPS.setWidth("650"); tbPS.setStyleClass("dataTable"); tbPS.setHeaderClass("dtHeader"); tbPS.setRowClasses("odd, even"); tbPS.setVar("item"); String[] header = new String[] { "Nome Comercial", "PrincÃÂpio Aivo", "Aplicação", "Carência" }; String[] attributes = new String[] { "nomeComercial", "principio", "aplicacao", "carencia" }; HtmlColumn column = null; HtmlOutputText otHeader = null; HtmlOutputText otValue = null; for (int i=0, iLen=header.length; i<iLen; i++) { column = new HtmlColumn(); column.setId("column"+i); otHeader = new HtmlOutputText(); otHeader.setId("otHeader"+i); otHeader.setValue(header); column.setHeader(otHeader); otValue = new HtmlOutputText(); otValue.setId("otValue"+i); otValue.setValueBinding("value",app.createValueBinding("#{item."+attributes+"}")); column.getChildren().add(otValue); tbPS.getChildren().add(column); } panel.getChildren().add(tbPS); }
The method "atualizarPanelProtocoloSanitario" is called on the click of a HtmlOutputText.
The problem is that the tab is not been displayed. The Modal Panel just shows the text "Protocolo Sanitário" and the button (img).
What iám doing wrong? Thanks a lot!