问题
I have a prime faces wizard and a dataTable, my page successfully go to the next wizard tab if I selected an item from the dataTable, but my problem is when inserting a new data to the dataTable I want the wizard to go to the next tab if the insert was successful, any suggestions please?
回答1:
You can use the client side API from backing bean, after the insert was successful.
Add a widgetVar to your wizard
<p:wizard widgetVar="wiz" ...>
...
<p/wizard>
Add the client execute, after the data is successfully inserted.
public void insertData() {
// Insert data
if (successfully) {
RequestContext context = RequestContext.getCurrentInstance();
context.execute("PF('wiz').next()");
}
}
来源:https://stackoverflow.com/questions/42607076/primefaces-wizard-move-to-the-next-tab-on-an-event