如何使用primeFaces中的push刷新dataTable

我需要知道如何在index2.xhtml中更改数据时更新index1.xhtml中的DataTable
使用push …我在index1.xhtml中定义socket,如下所示:

在豆子里:

 public void contract(){ .... PushContext pcont=PushContextFactory.getDefault().getPushContext(); pcont.push("/table",something); } 

我不知道的是,如何在javaScript中更新dataTable:

  function handle() { ??? }  

没有jQ技巧,这是一个更好的解决方案:

    

如果您不想丢失filter,这是一个更好的解决方案:

    

这是我的简单测试,当2.xhtml中的soclet从服务器接收到事件时,它会触发click事件到命令按钮,而这个命令按钮(你可以隐藏它)将更新你想要的目标:Bean:

 @ManagedBean(name = "globalCounter") @SessionScoped // option public class GlobalCounterBean implements Serializable { private static final long serialVersionUID = 1L; private int count; public int getCount() { return count; } public void setCount(int count) { this.count = count; } public void increment() { count++; PushContext pushContext = PushContextFactory.getDefault().getPushContext(); pushContext.push("/counter", String.valueOf(count)); } } 

1.xhtml:

        

2.xhtml: