0

我有一个显示包含数据的表格的弹出窗口,我可以选择一行,然后按 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()尚未实现,以便能够在主窗口上更新我的 outputText。

谢谢最好的问候

4

2 回答 2

1

根据您希望如何保留该值,将“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

    }
}
于 2013-10-15T18:14:39.267 回答
1

您还可以在调用弹出窗口的按钮或链接中使用 returnListener,如本文所示

于 2013-10-15T23:24:28.757 回答