Could you please provide a mvce and create a issue?
Otherwise it's almost impossible to help you.

2018-01-25 16:14 GMT+01:00 Matthew Broadhead <matthew.broadh...@nbmlaw.co.uk
>:

> hi,
> i just posted this question on stack overflow.  but then i tested
> switching to mojarra and that solved my problem so i guessed i would report
> it to this list
>
> Consider the following xhtml fragment:
>
> <h:form>
> <h:outputText value="#{myBean.items.size()}" />
> <ui:repeat var="item" value="#{myBean.items}">
>     <div>
>         <h:outputText value="#{item.id} #{item.name}" />
>         <h:commandButton value="delete" action="#{myBean.delete}">
>             <f:setPropertyActionListener target="#{myBean.item}"
> value="#{item}" />
>             <f:ajax render="@form" />
>         </h:commandButton>
>     </div>
> </ui:repeat>
> <c:forEach var="item" items="#{myBean.items}">
>     <div>
>         <h:outputText value="#{item.id} #{item.name}" />
>     </div>
> </c:forEach>
> </h:form>
> With the backing bean delete method:
>
> @Transactional
> public String delete() {
>     itemDao.delete(getItem());
>     setItems(itemDao.select());
>     return null;
> }
> And the itemDao methods like:
>
> public List<Item> select() {
>     CriteriaBuilder cb = em.getCriteriaBuilder();
>     CriteriaQuery<Item> cq = cb.createQuery(Item.class);
>     Root<Item> item = cq.from(Item.class);
>     cq.distinct(true);
>     TypedQuery<Item> query = em.createQuery(cq);
>     List<Item> itemList = query.getResultList();
>     return itemList;
> }
> public void delete(Project project) {
>     project = find(project.getProjectId());
>     em.remove(project);
> }
> The problem is that after the delete button is clicked the count is
> correct, the c:forEach is correct, but the ui:repeat is not updated and
> still shows the deleted element. Can someone suggest how to force the
> ui:repeat to also refresh?
>

Reply via email to