0
votes

I have two problems which are closely related:

  1. I need to update a form inside a tag inside ui:repeat from a dialog at the main page and cannot figure out how (because there are many tags in the ui:repeat and I need to update only one)
  2. naming containers are messed up and lose their "index" when I use id in that form (in case of trying to determine the update path expression...)

reason I need this: updating the 'wholelist' (current situation) breaks all <p:calendar> inside the <p:dialog> somehow (no errors...) (the calendar overlay shows at the first time, but after updating the list it does not appear any more (must reload page again). Also I don't want to update 100 elements each time if only one can be changed

page.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

and within the <customTag:someTag> (which is a tag because of multiple reuses) :

 ...
    <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>

First Question:

I need to refresh one single form from the dialog (=the dialog which needs to know which form I want to refresh, and I have no idea how to do so...)

And how can I get the update-logic working (pass the component to update to the bean so the dialog knows what to update or equal)?

Second Question:

why does JSF generate in case of not defining a id="..." to a naming container within a ui:repeat something like

  • repeatId:0:j_id_c0_6
  • repeatId:1:j_id_c0_6
  • repeatId:2:j_id_c0_6

and when I define a id to the form (<h:form id="formname">) something like

  • repeatId:formname
  • repeatId:formname
  • repeatId:formname

which causes duplicateId (because the lack of the "iterator-number" in the name)?

Does this make sense?

1
JSF implementation and version info? And is the p:dialog relevant? Or all PrimeFaces componemts for that matterKukeltje
MyFaces, JSF 2.0. the p:dialog is not relevant I think - it should underline that the form has to be accessible/updated from the root xhtml-page and not from inside the custom tag or anything else. Primefaces is relevant because the p:calendar breaks after refresh which is the reason I opened the question.Niko
p:calendar stops working if you update ":wholelist" on save and try it again (the second dialog has a non-working p:calendar)Niko
JSF-2.0 is a SPEC, not an implementation version 2.0.x isKukeltje
The calendar is outside the repeat and after that. So if that breaks due to something before it 'breaking', it is not calendar related.Kukeltje

1 Answers

0
votes

I have solved it; error was elsewhere: I have forgotten in an included tag file which caused the js warning (which broke the calendar).

many thanks