• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not getting the Edited Value of InputText when creating editable DataTable on server

 
Hemant
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I want to show a dynamic editable dataTable on Page. So, I am creating the dataTable on server and displaying it on page. It is working fine for me.My dataTable have some editable Cells with InputText in it. I have Added HtmlAjaxSupport onChange event of it, and ajax method is getting called properly, but I am not getting the changed value of that InputText in that Ajax call.

This is how my code looks :-
HtmlPanelGrid testGrid = new HtmlPanelGrid();
List<UIComponent> testComponentUI = testGrid .getChildren();

HtmlDataTable productTable = new HtmlDataTable();
productTable.setId("testTable" + productCount);
productTable.setVar("testTable");
productTable.setValue(groupedProducts);

HtmlInputText attribComponentType = new HtmlInputText();

// Add Ajax Support for onChange event
HtmlAjaxSupport ajaxSupport = new HtmlAjaxSupport();
ajaxSupport.setId("attribute_" + i + "_" + attribCount);
MethodExpression action = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createMethodExpression( FacesContext.getCurrentInstance().getELContext(), "#{placeOrderManager.getItemTotalPrice(testTable)}", String.class, new Class[] {});
ajaxSupport.setActionExpression(action);
ajaxSupport.setEvent("onchange");
ajaxSupport.setReRender("testTable" + productCount); attribComponentType.getFacets().put("a4jsupport", ajaxSupport);

ValueExpression valueExpression = createValueExpression("#{productTable.testList[" + count + "].orderAttributeValue}", String.class);
attribComponentType.setValueExpression("value",
valueExpression);
attributeColumn.getChildren().add(attribComponentType);

productComponentUI.add(productTable);// Add datTable to panelGrid

And my xhtml is like this,

<h:panelGrid id="demoGrid" binding="#{testGridAction.testGrid}" />

When I am changing the any InputText value of my dataTable to Ajax method get called, but when I inspect the the bean, I am not getting the changed value for that inputText variable.

Can anyone please guide me here, what am I missing?

Thanks


 
Hemant
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the solution for it!!!

I haven't given the id for the inputText ffield.
I just added
attribComponentType.setId("textInput_" + idCnt + "_" + attribCount);

and it is working fine javascript:%20x()
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic