| Author |
input text inside a datatable not updating
|
JP Estrada
Ranch Hand
Joined: Mar 21, 2006
Posts: 47
|
|
Hi guys.. i need help here. I need to create a datatable with dynamic number of columns. this is m code for that: public void createTableStructure() { table = new UIData(); Application app = FacesContext.getCurrentInstance().getApplication(); UIColumn col1 = new UIColumn(); UIOutput header = new UIOutput(); col1.setId("colCountry"); header.setValue("COUNTRY"); col1.setHeader(header); ValueBinding vb = app.createValueBinding("#{dynamic.country}"); //HtmlOutputText out = (HtmlOutputText)app.createComponent(HtmlOutputText.COMPONENT_TYPE); HtmlInputText in2 = (HtmlInputText)app.createComponent(HtmlInputText.COMPONENT_TYPE); in2.setValueBinding("value",vb); col1.getChildren().add(in2); UIColumn col2 = new UIColumn(); UIOutput header2 = new UIOutput(); col2.setId("colCity"); header2.setValue("CITY"); col2.setHeader(header2); ValueBinding vb2 = app.createValueBinding("#{dynamic.city}"); HtmlOutputText out2 = (HtmlOutputText)app.createComponent(HtmlOutputText.COMPONENT_TYPE); out2.setValueBinding("value",vb2); col2.getChildren().add(out2); table.getChildren().add(col1); table.getChildren().add(col2); String[] arr = getTestArray(); for(int x = 0;x < arr.length ;x++) { UIColumn col = new UIColumn(); UIOutput h = new UIOutput(); col.setId("col" + x); h.setValue(arr[x]); col.setHeader(h); ValueBinding vb3 = app.createValueBinding("#{dynamic.sectors[" + x + "]}"); //HtmlOutputText out3 = (HtmlOutputText)app.createComponent(HtmlOutputText.COMPONENT_TYPE); HtmlInputText in = (HtmlInputText)app.createComponent(HtmlInputText.COMPONENT_TYPE); in.setValueBinding("value",vb3); col.getChildren().add(in); table.getChildren().add(col); } } I'm able to create this table and populate its contents, which are displayed inside input text boxes. But when i change the contents displayed in the inputTexts, everytime i submit the form, the contents change back to their original value. It doesn't reflect the changs i made. What am i doing wrong here?
|
 |
JP Estrada
Ranch Hand
Joined: Mar 21, 2006
Posts: 47
|
|
|
Ahh.. i got it. i shouldn't be using HtmlInputText.. I should use UIInput!
|
 |
 |
|
|
subject: input text inside a datatable not updating
|
|
|