简体   繁体   English

RichFaces <a4j:support> 第一次尝试时不会重新渲染

[英]RichFaces <a4j:support> doesn't rerender on first try

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. 我正在将JSF 1.2与RichFaces 3.3.3(大型公司项目-尚无更新选项)一起使用,并且在使用<a4j:support>标记重新渲染某些字段时<a4j:support>问题。 I have a table, and a summary row, which displays values calculated in backing bean. 我有一个表和一个摘要行,其中显示了在后备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. 摘要行单元格应在其他行中的每次更改后自动更新,因此在每个触发更新的单元格上,我都有一个valueChangeListener ,该值在Bean上调用了“ recalculation”方法,并且<a4j:support reRender="[corresponding_summary_cell]" (...) />问题是,当我第一次用表加载页面时,重新渲染不起作用。 Ajax request is called, but returns some kind of an "empty" response. Ajax请求被调用,但是返回某种“空”响应。 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. TL; DR:得到了一个表格单元格,应使用该表格单元格进行ajax更新另一行,仅在重新加载后才能工作,第一次给出的响应类似于reRender属性为空。

Try adding one instance of your component above the table, with attribute rendered="false" . 尝试在表上方添加组件的一个实例,其属性为rendered="false" This will make sure JSF has loaded whatever is needed to process the tags. 这将确保JSF加载了处理标签所需的所有内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM