Primefaces Dialog Framework -- Dialogreturn Event From Menuitem
I have a primefaces p:datatable in Table.xhtml and have a p:commandbutton on the same page which I am using to open a dialog using dialog framework. The content related to dialog i
Solution 1:
I found the solution on How to trigger hidden JSF commandLink in JavaScript?
The updated version of Table.xhtml contains
<h:formid="form"><p:dataTableid="colors"var="col"value="#{tableDialog.resourceList}"rowKey="#{col}"selection="#{tableDialog.selected}"selectionMode="single"><p:columnheaderText="Model">
#{col}
</p:column></p:dataTable><p:contextMenufor="colors"><p:menuitemvalue="Add"onclick="triggerHiddenEvent(); return false;"update=" :form:colors " ></p:menuitem></p:contextMenu><p:commandButtonid="hiddenCommand"styleClass="button"action="#{tableDialog.updateValue}"style="display:none"><p:ajaxevent="dialogReturn"update = ":form:colors" /></p:commandButton><h:outputScript >
function triggerHiddenEvent() {
document.getElementById("form:hiddenCommand").click();
}
</h:outputScript></h:form>
Post a Comment for "Primefaces Dialog Framework -- Dialogreturn Event From Menuitem"