Primefaces向导移至事件的下一个选项卡

Primefaces向导移至事件的下一个选项卡

问题描述:

我有一个素人向导和一个dataTable,如果我从dataTable中选择了一个项目,我的页面会成功转到下一个向导选项卡,但是我的问题是在向dataTable插入新数据时我希望向导进入下一个选项卡,如果插入成功,请提出任何建议?

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?

插入成功后,可以使用支持Bean的客户端API.

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()");
    }
}