0

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?

Niko
  • 1,054
  • 5
  • 25
  • 52
  • JSF implementation and version info? And is the p:dialog relevant? Or all PrimeFaces componemts for that matter – Kukeltje Nov 22 '16 at 07:46
  • 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 Nov 22 '16 at 08:09
  • p:calendar stops working if you update ":wholelist" on save and try it again (the second dialog has a non-working p:calendar) – Niko Nov 22 '16 at 08:20
  • JSF-2.0 is a SPEC, not an implementation version 2.0.x is – Kukeltje Nov 22 '16 at 08:22
  • 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 Nov 22 '16 at 08:24
  • primefaces 5.1 myfaces bundle 2.2.0-20131222.194304-2575.jar – Niko Nov 22 '16 at 08:24
  • So you are using JSF 2.2, not 2.0... Please take care of profiding the right information. And you are using 2.2.0, that is rather old... Try more recent versions – Kukeltje Nov 22 '16 at 08:26
  • but how can I figure out if i have done something wrong? the first time it works (and all other times before refreshing the wholelist) but after refreshing the wholelist (all the other refreshes also work fine) it does not work anymore. I just don't understand why... – Niko Nov 22 '16 at 08:26
  • But this does not answer my question: how can i update a single form from outside the repeat? – Niko Nov 22 '16 at 08:50

1 Answers1

0

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

Niko
  • 1,054
  • 5
  • 25
  • 52