Hi guys,
i've tried lots of solutions,but i think i've find right solution to solve
my question.
I have to create a datatable with a fixed number of columns and other
dynamic columns.
I've rendered it using t:columns of Myfaces and it works fine.
It's a piece of jsp page

                <t:dataTable
    value="#{biosamplesTable.biosamples}" 
    var="biosampleItem"
        binding="#{biosamplesTable.biosampleDataTable}"  >
    <h:column >
        <f:facet name="header">
            <h:outputText value="Organism" />
        </f:facet>
       <h:selectOneMenu value="#{biosampleItem.organism}">
        <f:selectItems value="#{getDropList.selectOrganism}"/>
           
       </h:selectOneMenu>
etc..etc..    
        <t:columns value="#{biosamplesTable.columns}" var="col">
        <f:facet name="header">
                  <h:outputText value="Nuova" />
                  
        </f:facet>
        <h:inputText value="#{biosampleItem.column}" />
        
    </t:columns>
    
     <h:column>
        <f:facet name="header">
            <h:outputText value="Actions" />
        </f:facet>
        
                
        
        <h:commandButton
        value="Invia dati biosample"
actionListener="#{biosamplesTable.editBiosample}" id="editBiosample">
    
        </h:commandButton>
    
 
    </h:column>
        
</t:dataTable>  
 </h:form>      
 
}


My only question is:
I'm able to retrieve the h:column values for each row,i do it in
editBiosample method

public void editBiosample(ActionEvent event) throws SQLException {
                setBiosampleItem((Biosample) 
getBiosampleDataTable().getRowData());
                try {
                        
                        if (conn != null) {
                                Experiment exp = (Experiment) 
ViewUtils.eval("#{experiment}");
                                PreparedStatement pst3 = null;
                                pst3 = conn
                                                .prepareStatement("INSERT INTO 
campione(id_,organismo,protocollotrattamento,metodoestrazione,tipoamplificazione,protocolloibridazione,protocollomarcatura)
     
VALUES(?,?,?,?,?,?,?)");
 
                                pst3.setInt(1, exp.getAutoKey());
                                pst3.setString(2, 
getBiosampleItem().getOrganism());
                                pst3.setString(3, 
getBiosampleItem().getTreatmentProtocol());
                                etc...
                pst3.executeUpdate();
                pst3.close();
                        } 
                } 
                catch (Exception e) {
                        e.printStackTrace();
                }
        }



now i have to retrieve the h:columns values for each row,how can i do it?
Please help me,i've started so but there is some error,each values is null!!
For generating columns i've used..

public List getColumns() throws Exception {
        if (load2 == 0) {
        for (int i = 0; i < 3; i++) {
                UIOutput input = new UIInput();
        ValueBinding myItem = 
            FacesContext
                .getCurrentInstance()
                    .getApplication()
                        .createValueBinding("#{biosampleItem[" + i + "]}");
        input.setValueBinding("value", myItem);
        UIColumn column = new UIColumn();
        
        column.getChildren().add(input);
                columns.add(column);
                load2=1;
        }
        }
        else this.columns=columns;
        // Reload after every request.
 
        return columns;
}



what's wrong?
Please help me,i need to solve my problem...
thanks in advance...

-- 
View this message in context: 
http://www.nabble.com/t%3Acolumns-myFaces...please-help-me-tf2270642.html#a6302633
Sent from the MyFaces - Users forum at Nabble.com.

Reply via email to