0

我有两个密切相关的问题:

  1. 我需要在 ui:repeat 从主页的对话框中更新标签内的表单,但无法弄清楚如何(因为 ui:repeat 中有很多标签,我只需要更新一个)
  2. 当我以这种形式使用 id 时,命名容器会被弄乱并丢失它们的“索引”(以防试图确定更新路径表达式......)

我需要这个的原因:更新'wholelist'(当前情况)以某种方式破坏了所有<p:calendar>内容<p:dialog>(没有错误......)(日历覆盖第一次显示,但在更新列表后它不再出现(必须重新加载再次页面)。另外,如果只能更改一个,我不想每次更新 100 个元素

页面.xhtml

<h:panelGroup id="wholelist">
    <ui:repeat var="entry" value="#{bean.foundEntries}" id="repeatId">
        <customTag:someTag entry="#{entry}" />
    </ui:repeat>
</h:panelGroup>
... 
<p:dialog widgetVar="dialog" id="dialog">
    <p:calendar value="#{bean.date}" ... /> <!-- overlay pops up on select until the whole list is refreshed. after that it does not appear until page reload -->
    <p:commandButton actionlistener="#{bean.saveSomething()}" update="#{bean.componentToUpdate WHICH DOES NOT WORK...}"/>
</p:dialog>

someTag.xhtml

并在<customTag:someTag>(由于多次重复使用而成为标签)内:

 ...
    <h:form>
        ... display a lot of data which can be changed by the dialog...
        <p:commandButton value="show edit dialog" onComplete="PF('dialog').show()" update=":dialog">
           <f:setPropertyActionListener value="??? (@form does not work)" target="#{bean.componentToUpdate}" />
        </p:commandButton>
    </h:form>

第一个问题:

我需要从对话框中刷新一个表单(=需要知道我要刷新哪个表单的对话框,我不知道该怎么做......)

以及如何使更新逻辑正常工作(将要更新的组件传递给 bean,以便对话框知道要更新或相等的内容)?

第二个问题:

为什么 JSF 在没有定义 id="..." 到 ui:repeat 之类的命名容器的情况下会生成

  • 重复ID:0:j_id_c0_6
  • 重复ID:1:j_id_c0_6
  • 重复ID:2:j_id_c0_6

当我为表单 ( ) 定义一个 id 时,<h:form id="formname">类似于

  • 重复 ID:表单名称
  • 重复 ID:表单名称
  • 重复 ID:表单名称

这会导致duplicateId(因为名称中缺少“迭代器编号”)?

这有意义吗?

4

1 回答 1

0

我已经解决了;错误在别处:我忘记了一个包含的标记文件,它导致了 js 警告(破坏了日历)。

非常感谢

于 2016-11-24T08:09:33.597 回答