I have a primefaces datatable with a <p:rowEditor />
. The Logic of my process is when i click on a button it's suppose to:
- Jump to the last page of the Datatable
- Refresh the table
- Click on the edit button of the last row
in the footer i implemement a commandButton and remoteCommand looking like:
<f:facet name="footer">
<p:remoteCommand name="rctype" update="typeDT"
actionListener="#{myView.onNewType}" />
<p:commandButton id="btnNewType" ajax="true" onclick="rctype()"
update="typeDT" icon="ui-icon-plus" title="New Type"
value="New Type" >
</p:commandButton>
</f:facet>
my Bean looks like :
public void onNewType() {
try {
...
RequestContext.getCurrentInstance().execute("PF('widgettypeDT')
.paginator.setPage(PF('widgetinitiatorDT').paginator.cfg.pageCount - 1)");
RequestContext.getCurrentInstance()
.execute("jQuery('.typeClass')
.find('span.ui-icon-pencil').last().click();");
} catch() {}
}
But unfortunatly the Click Event always occur before the Jump Event.
How can i control the Execution order of my Javascript Events in my Managed Bean?