English 中文(简体)
导航到主页中数据表格的行选择上的另一页
原标题:Navigate to another page on rowselect of datatable in primefaces
调调

我有一个原始数据表 显示记录的数量。

我要浏览到行选择事件上的另一页( 编辑选中的实体)

The closest sample/demo I could find was use the p:ajax tag to bind the rowSelect event to a listener method http://www.primefaces.org/showcase-labs/ui/datatableRowSelectionInstant.jsf

我还为同一份http://forum.primefaces.org/viewtop.php?f=3&t=14664 获得一篇文章。

我试图执行他们一样。 但也没有成功。

我正以这种方式尝试 并指导我 如果我错过了任何东西。

   <p:dataTable var="product" value="#{addPatientBB.patientAddList}" paginator="true" rows="10" 
调      selection="#{addPatientBB.pat}" selectionMode="single"> 

    <p:ajax event="rowSelect" listener="#{addPatientBB.onRowSelect}" />  



调 <p:column>  
调     <f:facet name="header">  
调调  <h:outputText value="FirstName" />  
调     </f:facet>  
调     <h:outputText value="#{product.firstName}" />  
调 </p:column>  

调   <p:column>  

调     <f:facet name="header">  
调调  <h:outputText value="Email" />  
调     </f:facet>  
调   <h:outputText value="#{product.email}" />    

调    </p:column>  


调 <p:column>  
调     <f:facet name="header">  
调调  <h:outputText value="Gender" />  
调     </f:facet>  
调   <h:outputText value="#{product.gender}" />    

调    </p:column> 

     </p:dataTable>

背豆是:

@ManagedBean
@ViewScoped
public class AddPatientBB implements Serializable
{
    private Patient pat;

    public Patient getPat()
    {
    System.out.println("tried to get pat");
    return pat;
    }

    public void setPat(Patient pat)
    {
    this.pat = pat;
    System.out.println("tried to set pat");
    }

    public void onRowSelect()
    {
    System.out.println("inside onRow select  Method");
    ConfigurableNavigationHandler configurableNavigationHandler = (ConfigurableNavigationHandler) FacesContext.getCurrentInstance().getApplication().getNavigationHandler();

    System.out.println("navigation objt created");

    配置导航操作器。 performation Navigation (“ Page? faces- redirect= true ”) ; 配置导航操作器。 格式化导航( “ Page? faces- redirect= true ” ) ;

    // Page is my navigation page where I wish to navigate named as
    // "Page.xhtml"

    System.out.println("Navigation executed");

    }

}

因此, 我如何浏览到行选择事件上的另一页? 如何在导航窗体后显示它的值 。

我可以用RowSelect () 方法进去, 事实上问题是他无法获得或理解这条路径:

配置导航操作器。 performation Navigation (“ Page? faces- redirect= true ”) ; 配置导航操作器。 格式化导航( “ Page? faces- redirect= true ” ) ;

so he is not able to print any logs after this line. why is it so? is it because of I am using Liferay?

普拉指导我。

最佳回答

我认为在罗尔特选择上 从未被执行 因为你定义错了。

尝试此 :

public void onRowSelect(SelectEvent event)
{


  FacesContext.getCurrentInstance().getExternalContext().redirect("page.xhtml?id=" +pat.getId());


}
问题回答

暂无回答




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签