• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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()
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic