1

I'm using the 0.7 version of bootsfaces to create a simple page, which has something like the following:

<h:form id="some_form">
  <ui:repeat id="some_elements" var="property" value="#{someBean.properties}">
    <b:commandButton value="ShowProp" ajax="true" actionListener="#{someBean.showProperty(property)}" update=":some_form:some_elements:graphic"/>
    <!-- This property is true -->
    <ui:fragment rendered="#{someOtherBean.showGraphic}">
      <h:graphicImage url="gen_image?id=#{property.id}" id="graphic"/>
    </ui:fragment>
  </ui:repeat>
</h:form>

Now, the idea is that on clicking the button, a property is updated and the image should be re-generated (in this case a jfreechart graph - but this is besides the point.) I tested this with primefaces commandButton and it works fine (the graph is redrawn..) However with bootsfaces commandButton, nothing happens once the ajax call completes (I can see the call on the server side, but the graph is not reloaded.) I think it's down to how it must reference the image in the repeated block, but now sure what is wrong - has anyone come across this?

(NOTE: reason I don't want to use primefaces is that it does not integrate well with bootstrap)

4

1 回答 1

1

我在项目的 bugtracker(https://github.com/TheCoder4eu/BootsFaces-OSP/issues/135)上打开了一个错误。

实际上,您为什么一开始就期望它update=":some_form:some_elements:graphic"可以工作?这个表达式是一个不存在的 id。标识是some_form:some_elements:0:graphic. 换句话说:它包含行号。PrimeFaces(以及 Mojarra 和 MyFaces)识别命令按钮是 UIRepeat 组的一部分并猜测正确的行号。但这只是一个猜测。显然是一个合理的猜测,因为大多数时候你想更新命令按钮附近的东西。

BootsFaces 的下一个版本也将猜测正确的行号:)。

于 2015-07-18T12:17:00.770 回答