This is a follow up question to: Dynamically updating a4j:repeat using data from form
I now have 2 selects and next to them a commandbutton. When the button is pressed, the ul-list beneath the selects is updated with a line including the values of both selects and a remove button.
When I press the remove button, I want to remove the line (name+use rights pair) from the bean side and from the view. The pair is correctly removed from the arraylist on the bean side, but the ul-list is not updated. When I press F5, the element is removed from the list though.
How do I render the panelgroup again when I press the remove button?
<h:selectOneMenu value="#{assetUploadForm.currentGroupName}" valueChangeListener="#{assetUploadForm.groupNameChanged}">
<f:selectItems value="#{assetUploadForm.groupNames}" />
<a4j:ajax event="valueChange" render="second" execute="@this" />
</h:selectOneMenu>
<h:selectOneMenu value="#{assetUploadForm.currentGroupRW}" valueChangeListener="#{assetUploadForm.groupRWChanged}">
<f:selectItem itemValue="R" itemLabel="Read"/>
<f:selectItem itemValue="W" itemLabel="Write"/>
<a4j:ajax event="valueChange" render="second" execute="@this" />
</h:selectOneMenu>
<a4j:commandButton action="#{assetUploadForm.addGroupRights}" value="add group" render="groupList"/>
<h:panelGroup id="groupList">
<ul>
<a4j:repeat value="#{assetUploadForm.groupPermissions}" var="permission">
<li>
<h:outputText value="#{permission.group.groupName}"/>
<h:outputText value="#{permission.permissionMode}"/>
<a4j:commandButton action="#{assetUploadForm.removeGroupPermission}" render="groupList" value="remove">
<a4j:param value="#{permission.group.groupName}" assignTo="#{assetUploadForm.permissionToRemove}"/>
</a4j:commandButton>
</li>
</a4j:repeat>
</ul>
</h:panelGroup>
adding execute=”@this” to the remove commandButton resolved this issue.