[英]Pass information from popup to main window on Oracle ADF
我有一個彈出窗口顯示一個包含數據的表,我可以選擇一行,按下OK按鈕我可以檢索表中所選行的idNo。
我想要做的是將此idNo傳遞給調用彈出窗口的窗口並更新此窗口上的outputText。
有人能幫我嗎?
按鈕代碼:
按鈕的newBean類:
public String b1_action() {
// Add event code here...
System.out.println("Select One Button has been Clicked");
// Get bindings associated with the current scope, then access the one that we have assigned to our table - e.g. OpenSupportItemsIterator
DCBindingContainer bindings =
(DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dcItteratorBindings =
bindings.findIteratorBinding("NameView1_1Iterator");
// Get an object representing the table and what may be selected within it
ViewObject voTableData = dcItteratorBindings.getViewObject();
// Get selected row
Row rowSelected = voTableData.getCurrentRow();
// Display attriebute of row in console output - would generally be bound to a UI component like a Label and or used to call another proces
System.out.println(rowSelected.getAttribute("IdNo"));
setOutputText("" + rowSelected.getAttribute("IdNo") + "");
closePopup("p1");
return null;
}
我想要我的函數: setOutputText()
, setOutputText()
沒有實現,能夠在主窗口上更新我的outputText。
謝謝最誠摯的問候
將“IdNo”放在視圖或頁面流量范圍內,具體取決於您希望如何保留值。
//view scope
AdfFacesContext.getCurrentInstance().getViewScope().put("IdNo", value);
//or page flow scope
AdfFacesContext.getCurrentInstance().getPageFlowScope.put("IdNo", value);
在window bean中,為彈出對話框編寫一個監聽器:
public void dialogCloseListener(DialogEvent dialogEvent) {
if (dialogEvent.getOutcome().equals(DialogEvent.Outcome.ok)) {
String idNo = AdfFacesContext.getCurrentInstance().getViewScope().get("IdNo");
//now you have the idNo, do whatever you want
}
}
您也可以在按鈕或鏈接中使用returnListener,如本文中那樣調用彈出窗口
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.