Af:table: copy values of currently selected row to other attribute bindings

Hello,
I'm using JDev 11g.
Copying a value from one attribute value binding to another one is easy when you are clicking a button, with a setActionListener:
<af:setActionListener from="#{bindings.SourceField.inputValue}" to="#{bindings.DestinationField.inputValue}"/>What I want to do is the same behaviour, but instead of clicking a button, the triggering event should be the selection of a row on an af:table. The source field is a column of the currently selected row. The destination is another attribute value binding outside of the table.
Jspx:
<af:table value="#{bindings.EmployeesView1.collectionModel}" var="row">
  <af:column ... >
    <af:inputText value="#{row.bindings.SourceField.inputValue}" ... />
  </af:column>
</af:table>
<af:inputText ... value="#{bindings.DestinationField.inputValue}" />
...Page Def:
<bindings>
  <tree IterBinding="EmployeesView1Iterator" id="EmployeesView1">
    <nodeDefinition ... >
      <AttrNames>
        <Item Value="SourceField"/>
      </AttrNames>
    </nodeDefinition>
  </tree>
  <attributeValues IterBinding="EmployeesView1Iterator" id="SourceField">
    <AttrNames>
      <Item Value="SourceField"/>
    </AttrNames>
  </attributeValues>
  <attributeValues IterBinding="SomeOtherIterator" id="DestinationField">
    <AttrNames>
      <Item Value="DestinationField"/>
    </AttrNames>
  </attributeValues>
</bindings>What needs to happen in this simplified case is everytime a row is selected in the table, the value of the SourceField column (that also has an attribute value binding) should be copied to the DestinationField of some other iterator. Analogous to the setActionListener, but without a button. And in the real case, there are more columns of the selected row that need to be copied to more fields.
How can this be done? I already created a custom selectionListener for the table in a backing bean. In this selectionListener, the first thing I do is call the default "#{bindings.EmployeesView1.collectionModel.makeCurrent}". Then I fetch the current row, which is also no problem. So I now have access to the value of SourceField in my selectionListener in the backing bean. The only thing that is left now is copying this value to the "#{bindings.DestinationField.inputValue}" in Java, and that's where I'm stuck. :-)
Or even better ofcourse, is there a declarative way to do this without Java code?
Help would be greatly appreciated!
Chris

Hi Chris,
You should be able to use this utility method from JSFUtils class (part of FOD)
    public static void setExpressionValue(String expression, Object newValue) {
        FacesContext facesContext = getFacesContext();
        Application app = facesContext.getApplication();
        ExpressionFactory elFactory = app.getExpressionFactory();
        ELContext elContext = facesContext.getELContext();
        ValueExpression valueExp =
            elFactory.createValueExpression(elContext, expression,
                                            Object.class);
        //Check that the input newValue can be cast to the property type
        //expected by the managed bean.
        //If the managed Bean expects a primitive we rely on Auto-Unboxing
        Class bindClass = valueExp.getType(elContext);
        if (bindClass.isPrimitive() || bindClass.isInstance(newValue)) {
            valueExp.setValue(elContext, newValue);
    }edit... just realized you need this too
    public static FacesContext getFacesContext() {
        return FacesContext.getCurrentInstance();
    }John

Similar Messages

  • Need help on how to specify the current select row in a View Object

    Hi,
    I have a ADF table on my page, when I was selecting the rows in this table, I want the set and get methods in the ViewRowImpl class to do some customized actions. I found out that each time regardless the row I select in the table, the viewrowimpl class will always return the data in the first row, I tried to use getCurrentRow in VO row impl. but still, gets the first row.
    Does anyone know how to get the selected row value in the View Object, or View Row Impl rather???
    Thanks!

    Hi,
    you can call a method exposed by the AM and pass teh rowKey of the selected row as an argument. When you configure the exposed AM method in the pageDef (creating a method binding) the argument is shown in a dialog from where you can use EL like #{bindings.iteratorName.currentRow.rowKey} to access the current selected row.
    Frank

  • Highlighting currently selected row in a Report-Form page

    Hi,
    I have a page with Report - Form layout. On the top of the page there is a classical report (not IR). When the user click a row then I display a detail form below it. It would be nice if I could highlight the row the user clicked last time, to indicate to which row the detail data below the report belongs to. Did any body do something similar?
    Regards, Tamas

    It's relatively simple to achieve this&mdash;without JavaScript&mdash;using a named column report template and CSS:
    http://apex.oracle.com/pls/apex/f?p=34839:27:0
    We'll assume a page item (or items) already exists for receiving the master row primary key value(s). In the example this is P27_DEPTNO. Give the master report region a static ID for use in CSS selectors. Here this is department.
    If the master primary key value(s) are used as links in the report, then [column link] columns need to be created to replace them in the report attributes.
    Create a named column report template as required by your report query, including an HTML ID attribute for the report row element that contains column references to the primary key value(s). Replace column references in the row template for any primary key link columns with the [column link]s created previously. In the example, [column link] (ref #4#) replaces DEPTNO (ref #1#) as we need to reference the original DEPTNO value in the row ID:
    Row Template
    <tr id="dept-#1#">
      <td class="t17data">#4#</td>
      <td class="t17data">#2#</td>
      <td class="t17data">#3#</td>
    </tr>We then just need to use the selected P27_DEPTNO value via substitution in a page HTML Header to create a descendant selector that will apply a highlight to the cells in the currently selected row (along with some others to make it easier to select the row):
    CSS
    <style type="text/css">
    /* Make the whole table cell a link target */
    #department td {
      padding: 0;
    #department td a:link {
      display: block;
      padding: 2px 8px;
    /* Universal Selector sucks */
      font-size: 9pt;
    /* Highlight the selected row */
    #department tr#dept-&P27_DEPTNO. td {
      background-color: #eee;
    </style>

  • Get value of a selected row in a TableView

    Hi all.
    I'm very new to BSP-Extensions and don't know how to get the values of a selected row in a tableview. I've written a simple bsp with a tableview and a button (both htmlb). I want to get the selected values (as a workarea of tab or cell values) of the tableview at the moment where a user hits the button. I have thought that i could use the method GET_CELL_VALUE but it never works.
    Here are my type definitions:
    TYPES t_scarr TYPE TABLE OF scarr.
    Here are my page attributes:
    DATA pa_str_scarr TYPE scarr.
    DATA pa_tab_scarr TYPE t_scarr
    Here is the layout coding:
    <htmlb:content design           = "design2003"
                   controlRendering = "SAP" >
      <htmlb:document>
        <htmlb:documentHead>
        </htmlb:documentHead>
        <htmlb:documentBody>
          <htmlb:form>
            <htmlb:tableView id             = "tableview_scarr"
                             table          = "<%= pa_tab_scarr %>"
                             headerText     = "Table SCARR"
                             headerVisible  = "TRUE"
                             width          = "100%"
                             selectionMode  = "SINGLESELECT"
                             onRowSelection = "select" >
            </htmlb:tableView>
            <htmlb:button id      = "button_go"
                          text    = "Go"
                          onClick = "button_go" />
          </htmlb:form>
        </htmlb:documentBody>
      </htmlb:document>
    </htmlb:content>
    Here is the coding of OnInitialization:
    SELECT * FROM scarr INTO TABLE pa_tab_scarr.
    And this is my OnInputProcessing:
    DATA: event TYPE REF TO cl_htmlb_event,
          tv TYPE REF TO cl_htmlb_tableview,
          table_event TYPE REF TO cl_htmlb_event_tableview,
          selected_row_index TYPE selectedrow-index,
          cell_value TYPE string.
    IF event_id = 'htmlb'.
      event = cl_htmlb_manager=>get_event( runtime->server->request ).
      CASE event->server_event.
        WHEN 'button_go'.
          tv ?= cl_htmlb_manager=>get_data( request = request
                                            name    = 'tableView'
                                            id      = 'tableview_scarr' ).
          IF tv IS NOT INITIAL.
            table_event = tv->data.
            selected_row_index = table_event->selectedrowindex.
            cell_value = table_event->get_cell_value(
                row_index    = selected_row_index
                column_index = 1 ).
          ENDIF.
      ENDCASE.
    ENDIF.
    What is wrong and what is the best way to get the selected data at this moment?

    In your code....
    change
         <htmlb:button id      = "button_go"
                          text    = "Go"
                          onClick = "button_go" />
    to
         <htmlb:button id      = "button_go"
                          text    = "Go"
                          onClick = "onInputProcessing" />
    Also you are not getting the <b>selectedRowIndextable</b>.That might also be the problem...
    <b><i>Do reward each useful answer..!</i></b>
    Thanks,
    Tatvagna.

  • Check box als column in a standard table, how to get the selected row

    Dear experts,
    I habe standard tablt with check box as column. Now I want to get the current selected row structure and do some changes. How could I solve this problem? till now I just know to get the structure via lead selection.
    lo_node->get_element().
    lo_element = lo_node->get_static_attributes ( static_attributes = ls_row).
    How could I get the element through check-box in stead of lead selection. Many thanks!

    check this code
    To get the selected row number
    data: lr_element type ref to if_wd_context_element,
              lv_index type i.
      lr_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT'  ).
      lv_index = lr_element->get_index( ).
    Thanks
    Bala Duvvuri

  • How to capture a  charateristics value from a selected row in IP

    The requirements is to select a line in the summery layout and go to detail layout for further
    planning.
    In BPS, it's very easy to achieve this, since we can use the variables in the WIB to capture the value of selected line, In IP's query, after click a row, the selected row is highlight, but I am not sure how can we  pass the characteristics value of the selected row into a variable.  I did the following test by defining a variable for a account number characteristics in the row of a query, and define a dropdown filter with that account variable, after the query is launched in IP, when I click a row in the query, the account number dropdown filter value did not display the corresponding account number I choose. Anybody know how to achieve this?
    Thanks in advance

    Say your analysis item has 0material as one of the characteristics and say you can bind the material value on the selected line item to variable 'ZMAT' when the user clicks on a button. In the data binding section of the comand you want to perform when button is clicked you will make the fillowing settings:
    Variable - ZMAT
    Variable Type - 'SELECTION_BINDING
    Please give this a try.
    Regards

  • How to get the values of last selected row in Table?

    Hi,
    I have one editable table , where i have Create, Delete and Commit operation on it.
    When i am clicking on Create button it add new row to my table.
    But I want the value of my last selected row from the table in my Bean.
    Can anyone suggest me please....... its urgent
    Jdev:- 11.1.1.0.3
    Thanks,
    Ramit

    just get this code empTable is the table binding
                    RowKeySet rks = new RowKeySetImpl(); 
                    CollectionModel model = (CollectionModel)empTable.getValue(); 
          RowKeySet selectedRowKeys = empTable.getSelectedRowKeys();
          if (selectedRowKeys != null)
                Iterator iter = selectedRowKeys.iterator();
                if (iter != null && iter.hasNext())
                  empTable.setRowKey(iter.next());
                  model.setRowIndex(empTable.getRowIndex()); 
                  Object key = model.getRowKey(); 
                  rks.add(key); 
                    empTable.setSelectedRowKeys(rks); 
          AdfFacesContext.getCurrentInstance().addPartialTarget(empTable);
        public void setEmpTable(RichTable empTable) {
            this.empTable = empTable;
        public RichTable getEmpTable() {
            return empTable;
        }

  • Display and edit currently selected row of ADF Table in ADF Form

    I have an ADF Read-only Table and ADF Form, which were created from the same Data Control.
    I need to be able to edit the selected row of the table in the form (just like in "Binding Data Controls to your JSF page" part of "Developing RIA Web Applications with Oracle ADF" Tutorial). However, I can't figure out how to do this :(
    I found the following solution on the Web: #{bindings.DeptView1.currentRow.dataProvider.dname} - but it doesn't work, since "the class oracle.jbo.server.ViewRowImpl does not have the property dataProvider".
    Sorry for the newbie question.
    Thanks in advance for any help!

    Hi,
    AFAIK, dataProvider is not supported on ADF BC, hence the error.
    If you have created ADF Read only table and form from the same data control you just need to refresh the form based on table selection to show up the selected record, to do which you just need to add partialTriggers property to the panelFormLayout and set its value to the id of table
    Sireesha

  • How do I get the values from a selected row.

    I am using JDeveloper 9.0.5. On my page, I have placed a button within a table. The button has been assigned an event. The event is within my Action class. This class implements DataAction and has overriden the
    processComponentEvents(DataActionContext actionContext);
    method.
    Question: While I am within the processComponentEvents method, is it possible to obtain the values of selected row?

    Good Morning Jeffery,
    First off thanks for your clear explanation. I have a few related questions as noted from your response:
    There are two ways to communicate the desired model row between the UIX view and the struts controller. One way is to use the singleSelection component in your table and put your buttons in the singleSelection's contents.
    When the user selects the radio button for a particular row and then clicks on one the buttons, a built in event handler in UIX will set the current row in the model to be the user selected row. Therefore, your Struts action can operate on the currently selected model row.
    When you drop a UIX table from the data control palette it is automatically set up in this way (with a single selection).
    Ok, Lets say that i've set everything up as you described. Not lets say that the button was pressed and I hit the overriddenprotected void processComponentEvents(DataActionContext actionContext) throws IOException, ServletException ;
    When I look at the request object, I do not see the values. How do I get access to the rowkey at this point?
    Some people, however, want to actually render buttons in their table rows, and have those buttons initiate an action on their row. If you are doing this, then you need to pass the row id to your struts action as a parameter, which means that you need to know the row id when you are rendering a button for a given row. There is an EL expression that will return the row-id for the current row, it is:
    ${uix.current.rowKeyStr}
    which is not so obvious or well documented in the preview release (sorry) but should be for the production release.
    A generic code snippet would go a long way to shedding some light on that. I guess I am use to using JDeveloper 9.0.3. It seems,"to me", that JDev 9.0.5 has put a completely new twist on things. I find myself wondering when I can use the 9.0.3 syntax and when
    should not. If your team has any short source toys around which demonstrated using rowkeys, or accessing the internal parts of the
    struts controller, I would find that invaluable. It dose not matter if this information is documented.
    Thank you

  • I need some syntax help with reading some values from a selected row in an Access form.

    My goal:  to extract the data from 4 fields in a datasheet row and place them in another form.
    My problem:  I can only get the field values from the first row of the datasheet.
    I have tried using the Form_Click event as the location for the code I've tried.  This seems to be the right place, but apparently referring to the desired fields by their names with Me. in front just references the first record in the datasheet, not
    the one I've selected.
    Should I just read the source form's recordset using the Currentrecord value somehow?  I could use some direction on that.
    Thank you.
    Marj Weir

    It's generally considered good forum etiquette to post back a description of the solution which you've reached.
    The normal control for a multi-valued field is a combo box rather than a text box, but unless it is necessary for you to use a  multi-valued field, i.e. your database is interfacing with SharePoint in the very limited context in which this feature is necessary,
    I'd advise that you model the many-to-many relationship type in the time-honoured way by means of a table which resolves the relationship type into two one-to-many relationship types, and use a subform to show the data.  You can alternatively use a multi-select
    list box or a text box which shows a value list.  You'll find examples of all three methods in StudentCourses.zip in my public databases folder at:
    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
    If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
    Ken Sheridan, Stafford, England

  • How to get column value of a selected row of ALV

    Hello ,
    I have application POWL POWL_UI_COMP uses  another component  POWL_TABLE_COMP.
    This POWL_TABLE_COMP uses SALV_WD_TABLE.
    I want to select value of ORDER id and it need to be passed whenever user selects a display order button(Which is self defined function generated in POWL_TABLE_COMP) . I am calling a display order on action of this display button(http://nap60.nalco.one.net:8042/sap/bc/webdynpro/sap/mt_order_app?IV_ACTIVITYTYPE=A&IV_EQUIPMENT=aaaa&IV_ORDERID=90001511&IV_ORDERTYPE=STD&IV_QMNUM=00&IV_TPLNR=00)
    ORDERID is one column value of selected row of ALV table.
    So please can you suggest , how to read ORDERID and pass it to the self defined function..
    thanks in advance,
    Sharada

    Anoop,
    I have plcaed this code in event handler of  on_lead_select.
    Its giving error  the element doesnt exist. 
    static_attributes should give me row data but it's giving short dump saying
    Pl can you suggest.
    data:   set_of_element type WDR_CONTEXT_ELEMENT_SET,
            element1 type ref to IF_WD_CONTEXT_ELEMENT,
            result type POWL_CRESULT_STY,
            table_helper type ref to CL_POWL_TABLE_HELPER,
          context_node type ref to IF_WD_CONTEXT_NODE,
           lt_selected_elements TYPE wdr_context_element_set,
           static_attributes type ref to data.
      table_helper = wd_comp_controller->mr_table_helper.
      context_node = table_helper->get_data_node( ).
      context_node = wd_comp_controller->mr_table_helper->get_data_node( ).
      context_node->get_static_attributes( exporting index = r_param->index
                                          importing static_attributes = static_attributes ).
    thanks,
    Sharada

  • How can I get the values of the selected row in the report?

    Hi All:
    I have a dynamic query(lexical parameters)that columns are selected at the run time. And depend on the values, I'd like to do another query just for certain row. For example, when I double click on the fifth column of the fifth row. I'd like to collect all the column values of this fifth row. I think It likes drill-down report, but I don't need a detail report. I just want a string of the combination column's values. Would you please help?
    Thanks, in advances, for your help.
    TD

    Hi:
    I got it.
    Thx,
    TD

  • Value of currently selected tree node

    Hi there,
    I'm new to Apex(4.1.1) and i'm having a little problem.
    I got 2 Pages. The frist one consists of a treeregion and a submit button.
    The Second one is a Report.
    I want to create a workflow, that the user selects a treenode and presses submit. Then he'll be redirected to the reportspage,
    wich will show him a report depending on the treenode he selected on the first Page.
    Problem:
    I have no idea how i can read the value of the selected treenode.
    I hope you can help me.
    thanks,
    Frederic

    Hi Frederic,
    To obtain the value of the selected tree node, you can make use of the "Selected Page Node Item" attribute on the Tree Attributes page. Just create an item on your page, and set the "Selected Page Node Item" to that new page item. Then populate that item via the LINK parameter of your tree query. For an example, take a look at the following: http://apex.oracle.com/pls/apex/f?p=36648:6 , where I'm setting my page item P6_SELECTED_NODE to the value of the node selected on the first tree i.e. empno. Your report query would need to reference the "Selected Page Node Item", to ensure that it displays information related to the selected tree node.
    I hope this helps.
    Regards,
    Hilary

  • Copy values from one Parent node to other Parent Node

    Hi all,
    I have a 2 Parent node each having 3 child nodes. I want to copy the values of all the attributes of all the child nodes of one Parent Node to corresponding other node.
    Both the Parent Nodes as well as their Child Nodes have different name but their attributes have same name.For ex:
    Parent Node -A
    Child Nodes - a, b,c
    Child Node "a" has attributes "x" and "y"
    Parent Node -B
    Child Nodes - d,e,f
    Child Node "d" has attributes "x" and "y" .
    Now I want to copy the values od attributes "x" and "y" from one Parent Node to other Parent node.
    Please help me out.
    Helpful answers will be rewarded.
    Thanxs in advance...

    Hi Jin,
    To use copy service API, u need to satisfy 2 condition for the attributes of source node and target node:
    1. The name of the attribute should be same (including the case of the name)- Abc is different from ABC
    2. Type of the attribute should also be the same.
    copy elements works for copying values from Model node to context and does not work vice-versa. To enable the copying of context node to model node, use copycorresponding API.
    Eg:
    int contextNodeSize = wdContext().node<contextNodeName>().size();
    for(int i = 0; i < contextNodeSize; i++)
         <modelNodeName> modelObject = new <modelNodeName>();
         <contextNodeName>Element contextObject = wdContext().node<contextNodeName>().get<contextNodeName>ElementAt(i);
         WDCopyService.copyCorresponding(contextObject, modelObject);
    This will copy the values from Context Node to Model Node.
    Hope this helps you.
    Regards,
    Poojith MV

  • Get the value from a selected row in a table

    Hi all,
    My table contains a tree structure.
    When I select a single row, I need to get the value of a particular column.
    I created an action on the leadSelect of the table and gave the following code:
    public void onActionleadValue(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionleadValue(ServerEvent)
        String strLeadValue = wdContext.nodeAttribute_View_Out().currentAttribute_View_OutElement().getAttributeAsText("<MyModelAttributename>");
        wdComponentAPI.getMessageManager().reportSuccess("selected lead value "+strLeadValue);
        wdContext.currentContextElement().setLeadselectedvalue(strLeadValue);
        //@@end
    My Bapi returns me 6 records. and when I click on any row its always pointing to the last record value.
    What could be the problem?
    Thanks
    Anjana

    Hi Anjana,
    Try this.
    try
         IWDMessageManager msg = wdComponentAPI.getMessageManager();
         int leadselect = wdContext.nodeSChild1().getLeadSelection();
          for(int i=0;i<wdContext.nodeSChild1().size();i++)
              if(leadselect == i)
              //Displaying output in diff table
    //           IPublicTestComp.ITableNodeElement tabelm = wdContext.createTableNodeElement();
    //           tabelm.setAttribute1(wdContext.nodeSChild1().getSChild1ElementAt(i).getAttribute1());
    //           tabelm.setAttribute2(wdContext.nodeSChild1().getSChild1ElementAt(i).getAttribute2());
    //           tabelm.setAttribute3(wdContext.nodeSChild1().getSChild1ElementAt(i).getAttribute3());
    //           wdContext.nodeTableNode().addElement(tabelm);
              String att1 = wdContext.nodeSChild1().getSChild1ElementAt(i).getAttribute1();
              String att2 = wdContext.nodeSChild1().getSChild1ElementAt(i).getAttribute2();
              String att3 = wdContext.nodeSChild1().getSChild1ElementAt(i).getAttribute3();
                     msg.reportSuccess("Row ("i") : "att1"====="att2"======"+att3);
    } catch (WDDynamicRFCExecuteException e) {
         wdComponentAPI.getMessageManager().reportException("Message : "+ e.getMessage(),true);
    Regards,
    Mithu

Maybe you are looking for

  • In ical no sync from MBAir to iphone

    in ical no sync from MBAir to iphone but it works the other way around, i. e. from iphone to MBA. Do I miss some setting?

  • How do iPhoto and iTunes libraries connect to iMovie?

    I'm still having trouble with iMovie '08 being unable to "see" or show still photos or sounds from the iPhoto and iTune libraries. It does not seem to even know those libraries exist. Can someone at least tell me how iMovie normally connects to those

  • E71 messaging stops with same message - any ideas?...

    I have several hotmail accounts running and stop after approx 7 days with the message below. I have deleted and reassigned works temporarily but problem re occurs. Any ideas how to rectify permanently. No settings have changed. Dear Nokia Messaging c

  • Can I transfer my video tapes directly into Premiere Elements?

    Hi how do I transfer my super 8 videos into adobe Premiere. Do I need anything special or can I just connect my old camcorder to my computer and allow Premiere process the video?  One I know is that I will need a RCA cable with yellow (video) and Bla

  • Batch processing green screen videos

    Hi, I'm working on a project where I will need to automate the processing of 1 min videos shot in front of the same greenscreen in a video booth. Is it posable to automate actions in AE like you can in photoshop? What I'd like to automate is 1. open