0
votes

I'm using JSF 1.2 with RichFaces 3.3.3 (big company project - no options to update yet) and I have a problem with rerendering some fields with <a4j:support> tag. I have a table, and a summary row, which displays values calculated in backing bean. The summary row cells should auto update after every change in the other rows, so on every cell which triggers an update, i've got a valueChangeListener which calls "recalculation" method on the bean and a <a4j:support reRender="[corresponding_summary_cell]" (...) /> The problem is when I first load the page with a table the rerendering doesn't work. Ajax request is called, but returns some kind of an "empty" response. Only when I reload the view (by clicking a link to the page for example) the requests start to work as intended, an correctly update corresponding summary cells.

The kind-of-empty response contents fragment:

<body>
  <meta name="Ajax-Update-Ids" content="" /><span id="ajax-view-state">    
  <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id11" autocomplete="off" /></span>
  <meta id="Ajax-Response" name="Ajax-Response" content="true" />
  <meta name="Ajax-Update-Ids" content="" />
  <span id="ajax-view-state">
    <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="j_id11" autocomplete="off" />
  </span>
  <meta id="Ajax-Response" name="Ajax-Response" content="true" />
</body>

The cell which triggers a calculation example:

<customNamespace:moneyValue value="#{someAttribute}" id="field1" valueChangeListener="#{controller.calculateSums}">
   <a4j:support event="onchange" reRender="Form-Table-Cost1Sum"/>
</customNamespace:moneyValue>

The rows in the table are added dybnamically, but it's only the first time (added first row to an empty table) which gives the problem, next rows work ok. I also tried re-rendering whole form - nothing changed.

TL;DR: Got a table cell with which should ajax-update another row, works only after reload, first time gives response like reRender attribute was empty.

1

1 Answers

0
votes

Try adding one instance of your component above the table, with attribute rendered="false". This will make sure JSF has loaded whatever is needed to process the tags.