ADF 双击 Table 跳转到另一个视图

双击table中的某行,然后跳转到该行的查看视图。

分别在页面 Table组件中加入 客户端监听和服务监听,加入JS代码,调用BackingBean,执行跳转。

ADF Table 中需要的属性:

页面中Table组件,加粗部分为需要添加的代码。

<af:table value="#{bindings.UserTableView1.collectionModel}"
                              var="row"
                              rows="#{bindings.UserTableView1.rangeSize}"
                              filterVisible="true" varStatus="vs"
                              selectedRowKeys="#{bindings.UserTableView1.collectionModel.selectedRow}"
                              selectionListener="#{bindings.UserTableView1.collectionModel.makeCurrent}"
                              rowSelection="single" id="t1"
                              partialTriggers="::cb3"
                              binding="#{backingBeanScope.staffManageBean.t1}"
                              styleClass="AFStretchWidth"  >
            <af:clientListener method="handleTableDoubleClick" type="dblClick"/>
            <af:serverListener type="TableDoubleClickEvent" method="#{backingBeanScope.staffManageBean.handleTableDoubleClick}"/>

                   
                        <af:column sortProperty="#{bindings.UserTableView1.hints.StaffNo.name}"
                                   filterable="true" sortable="false"
                                   headerText="#{bindings.UserTableView1.hints.StaffNo.label}"
                                   id="c5">
                            <af:outputText value="#{row.StaffNo}" id="ot5"/>
                        </af:column>

....

form组件中加如下JS:

	<af:resource type="javascript" >
		function handleTableDoubleClick(evt){ 
			var table = evt.getSource();
			AdfCustomEvent.queue(table, "TableDoubleClickEvent",{}, true);
			evt.cancel();
		}
	</af:resource>


backingBean中的代码:

	public void handleTableDoubleClick(ClientEvent ce){
	       navToOutCome("toView");//跳转到taskFlow中的 “toView”页面               
               //刷新Psl1为页面第一个组件,上级为改页面Jsff,即刷新Jsff 
               AdfFacesContext.getCurrentInstance().addPartialTarget(this.getPsl1().getParent());
	}
	//跳转方法
	public void navToOutCome(String outCome) {  
	        FacesContext facesContext = FacesContext.getCurrentInstance();  
		Application application = facesContext.getApplication();  
	        NavigationHandler navigationHandler = application.getNavigationHandler();  
			
		ControllerContext controllerContext = ControllerContext.getInstance();  
		String viewId = controllerContext.getCurrentViewPort().getViewId();  
			
		if (viewId != null) {  
		       navigationHandler.handleNavigation(facesContext, viewId, outCome);  
		}  
	}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值