This discussion is archived
4 Replies Latest reply: Dec 9, 2012 7:37 PM by 960568 RSS

populate row from popup to table line.

960568 Explorer
Currently Being Moderated
Hi,

I am using jdev 11.1.2.0

my requirement is to select row from popup and display in table which is in page from which pop up is from.How to achieve this.?

I have 10 blank line.Clicking on button should open a pop up and selecting row from popup and populate in the table lines.How to do this.
  • 1. Re: populate row from popup to table line.
    Timo Hahn Oracle ACE
    Currently Being Moderated
    User,
    what do you mean by you have 10 blank lines? What is a blank line? a table or just a number of empty inputText components?
    What is shown in the popup?
    Do you only want to copy the values?

    In general you can e.g. select a row of a table in the popup and in the in a popuplistener copy the values from the selected table row into the inputtext components on the page.

    Timo
  • 2. Re: populate row from popup to table line.
    960568 Explorer
    Currently Being Moderated
    what do you mean by you have 10 blank lines? What is a blank line? a table or just a number of empty inputText components?-->>> yes it is table blank lines.
    What is shown in the popup? - a query panel which show result in table.
    Do you only want to copy the values?*-yes i want to copy the selected row from that table in popup and show or populate to table which is in parent pag*e.

    how to copy the rows and populate the value. any pointers

    Edited by: 957565 on Nov 16, 2012 7:57 AM
  • 3. Re: populate row from popup to table line.
    Timo Hahn Oracle ACE
    Currently Being Moderated
    Ok, what I would do is to use a af:dialog inside the popup as this allows you to catch the OK event. On this dialogEvent (user hits OK) you get the selected row of the table. Ince you have the row you can get the values you like to copy and put them into the inputtext bindings on the page.
    I made a small sample using using a af:query with table in a popup and two inputText components on hte page which are filled with the values from the selected row in the popup table. To make it easier for me I dropped the VO which I used for the query panel with table again onto the popup as adf form. This will build bindings for each attribute of a table row. These bindings are filled with the values of the selected row of the table. As you don't want to see the input form, you switch to the source view of the page and delete the af:panelFormLayout and all containing elements. This will remove the form, but leave the bindings as is.

    In the dialogListener of the popup I get the values from the generated and put them into the inputText components on my page.
    here is the code for the dialogListener:
        public void dialogListener(DialogEvent dialogEvent) {
            Outcome outcome = dialogEvent.getOutcome();
            if (dialogEvent.getOutcome().equals(Outcome.ok )) {
                
                // get the binding container
                BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
                // get an ADF attributevalue from the ADF page definitions
                AttributeBinding attr = (AttributeBinding)bindings.getControlBinding("LocationId");
                String id =  attr.getInputValue().toString();
                AttributeBinding selattr = (AttributeBinding)bindings.getControlBinding("SelId1");
                selattr.setInputValue(id);
                // put the value to the inputText component on the page
                attr = (AttributeBinding)bindings.getControlBinding("DepartmentName");
                String name=  (String)attr.getInputValue();
                selattr = (AttributeBinding)bindings.getControlBinding("SelName1");
                            selattr.setInputValue(name);
                //_logger.info("Selected value: " + id + " " + name);
                // PPR refresh a jsf component holding the input text components
                AdfFacesContext.getCurrentInstance().addPartialTarget(this.copyGroup);
            }
        }
    and the page code:
                <af:panelGroupLayout id="pgl1">
                  <af:commandButton text="commandButton 1" id="cb1"
                                    actionListener="#{PopupBean.popupListener}" partialSubmit="true"/>
                  <af:commandButton text="commandButton 2" id="cb2">
                    <af:showPopupBehavior popupId="p1" triggerType="action" align="endAfter"
                                          alignId="cb1"/>
                  </af:commandButton>
                  <af:panelGroupLayout id="pgl3" binding="#{PopupBean.copyGroup}">
                    <af:inputText label="LocationId" id="it1" value="#{bindings.SelId1.inputValue}"/>
                    <af:inputText label="Name" id="it2" value="#{bindings.SelName1.inputValue}"/>
                  </af:panelGroupLayout>
                  <af:popup id="p1" contentDelivery="lazyUncached" clientComponent="true">
                    <af:dialog id="d2" dialogListener="#{PopupBean.dialogListener}">
                      <af:panelGroupLayout layout="vertical" id="pgl2">
                        <af:panelHeader text="Departments" id="ph1">
                          <af:query id="qryId1" headerText="Search" disclosed="true" value="#{bindings.MYAllAttributesQuery.queryDescriptor}"
                                    model="#{bindings.MYAllAttributesQuery.queryModel}" queryListener="#{bindings.MYAllAttributesQuery.processQuery}"
                                    queryOperationListener="#{bindings.MYAllAttributesQuery.processQueryOperation}" resultComponentId="::resId1"/>
                        </af:panelHeader>
                        <af:table value="#{bindings.DepartmentsView1.collectionModel}" var="row" rows="#{bindings.DepartmentsView1.rangeSize}"
                                  emptyText="#{bindings.DepartmentsView1.viewable ? 'No data to display.' : 'Access Denied.'}"
                                  fetchSize="#{bindings.DepartmentsView1.rangeSize}" rowBandingInterval="0"
                                  selectedRowKeys="#{bindings.DepartmentsView1.collectionModel.selectedRow}"
                                  selectionListener="#{bindings.DepartmentsView1.collectionModel.makeCurrent}" rowSelection="single" id="resId1">
                          <af:column sortProperty="DepartmentId" sortable="false" headerText="#{bindings.DepartmentsView1.hints.DepartmentId.label}" id="resId1c1">
                            <af:outputText value="#{row.DepartmentId}" id="ot3">
                              <af:convertNumber groupingUsed="false" pattern="#{bindings.DepartmentsView1.hints.DepartmentId.format}"/>
                            </af:outputText>
                          </af:column>
                          <af:column sortProperty="DepartmentName" sortable="false" headerText="#{bindings.DepartmentsView1.hints.DepartmentName.label}"
                                     id="resId1c2">
                            <af:outputText value="#{row.DepartmentName}" id="ot7"/>
                          </af:column>
                          <af:column sortProperty="ManagerId" sortable="false" headerText="#{bindings.DepartmentsView1.hints.ManagerId.label}" id="resId1c3">
                            <af:outputText value="#{row.ManagerId}" id="ot6">
                              <af:convertNumber groupingUsed="false" pattern="#{bindings.DepartmentsView1.hints.ManagerId.format}"/>
                            </af:outputText>
                          </af:column>
                          <af:column sortProperty="LocationId" sortable="false" headerText="#{bindings.DepartmentsView1.hints.LocationId.label}" id="resId1c4">
                            <af:outputText value="#{row.LocationId}" id="ot2">
                              <af:convertNumber groupingUsed="false" pattern="#{bindings.DepartmentsView1.hints.LocationId.format}"/>
                            </af:outputText>
                          </af:column>
                          <af:column sortProperty="MaxSalary" sortable="false" headerText="#{bindings.DepartmentsView1.hints.MaxSalary.label}" id="resId1c5">
                            <af:outputText value="#{row.MaxSalary}" id="ot5">
                              <af:convertNumber groupingUsed="false" pattern="#{bindings.DepartmentsView1.hints.MaxSalary.format}"/>
                            </af:outputText>
                          </af:column>
                          <af:column sortProperty="Hello" sortable="false" headerText="#{bindings.DepartmentsView1.hints.Hello.label}" id="resId1c6">
                            <af:outputText value="#{row.Hello}" id="ot4"/>
                          </af:column>
                        </af:table>
                      </af:panelGroupLayout>
                      
                    </af:dialog>
                    
                  </af:popup>
                </af:panelGroupLayout>
    Timo
  • 4. Re: populate row from popup to table line.
    960568 Explorer
    Currently Being Moderated
    Thanks Timo for your help.

    But on the page itself i am having one blank table with mulplte blank rows and on the pop up page also we have table which show multiple result.Is there any other way we can do this
    ..

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points