Hello,
I write a program which should show Data in a Table and the user should be
able to edit them.
The Table has to be generated dynamicaly. For simplicity I create a table
with 2 cols und 2 rows. When I run the application there appears a problem.
The valueChanged - Method is just called when I change the value of one of
the two fields in the first column.
Why isnt the Method called when I change the value of a field of the second
column?

My jsp-File looks as followed:
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
<%@ taglib uri="http://myfaces.apache.org/tomahawk"; prefix="t" %>

<html>
        <head>
                <title>Vitax Web 1.0</title>
        </head>
        <body>
                <f:view>
                <h:form id="taxForm">
                <t:dataTable id="taxTable" var="row" 
value="#{taxTable.tableModel}">
                        <t:columns value="#{taxTable.columnModel}" var="col">
                                <f:facet name="header">
                                        <h:outputText value="#{col}" />
                                </f:facet>
                                <t:inputText id="in" 
value="#{row[taxTable.columnModel.rowIndex]}"
                                        
valueChangeListener="#{taxTable.valueChanged}" immediate="true"   
                                        onchange="submit()">            
                                </t:inputText>  
                        </t:columns>
                </t:dataTable>          
                </h:form>
                </f:view>
        </body> 
</html> 

Here is the code for the taxTable SessionBean:
public class TaxTable {
        private javax.faces.model.ListDataModel tableModel;
        private javax.faces.model.ListDataModel columnModel;
        public SessionBean() {
        }

        public void valueChanged(ValueChangeEvent evt) {
                System.out.println("Old Value: "+evt.getOldValue().toString());
                System.out.println("New Value: "+evt.getNewValue().toString());
        }
        

        
        public javax.faces.model.ListDataModel getTableModel() {
                if(tableModel == null) {
                        Object[] o1 = new Object[] {"Zeile 1", new Integer(1)};
                        Object[] o2 = new Object[] {"", new Integer(2)};
                        List<Object[]> l = new ArrayList<Object[]>();
                        l.add(o1);
                        l.add(o2);              
                        tableModel = new ListDataModel(l);
                }
                return tableModel;
        }

        public void setTableModel(javax.faces.model.ListDataModel tableModel) {
                this.tableModel = tableModel;
        }

        public javax.faces.model.ListDataModel getColumnModel() {
                if(columnModel == null) {
                        String[] o1 = new String[] {"Spalte1", "Spalte2"};
                        List<String> l = new ArrayList<String>();
                        l.add(o1[0]);
                        l.add(o1[1]);
                        columnModel = new ListDataModel(l);
                }
                return columnModel;
        }

        public void setColumnModel(javax.faces.model.ListDataModel columnModel) 
{
                this.columnModel = columnModel;
        }
}

Please help me.
Thx!

-- 
View this message in context: 
http://www.nabble.com/DataTable-with-Inputfields-Problem-tf3704159.html#a10358693
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to