This discussion is archived
1 2 Previous Next 21 Replies Latest reply: Dec 13, 2012 6:41 AM by 925715 Go to original post RSS
  • 15. Re: Not getting selected row values on commnadLink click???
    Suresh Karunarathne Guru
    Currently Being Moderated
    Hi,
    Try after adding
    selectedRowKeys="{bindings.ViewObjectName.collectionModel.selectedRow}"
    and set rowSelection="single"

    Refer
    http://docs.oracle.com/cd/E23943_01/apirefs.1111/e12419/tagdoc/af_table.html
    still issue is not resolved share your code table code stuff
  • 16. Re: Not getting selected row values on commnadLink click???
    925715 Explorer
    Currently Being Moderated
    Hi Suresh,

    Thanks for ur response,
    Let me explain you my usecase clearly such that you can give any suggestions.
    My usecase is:

    i have created one ADF table with 10 columns. Out of which first column(Empno) i modified to commandLink and provided Action: Link1().

    The code in the Link1() method is as follows:

    public String Link1() {
    // Add event code here...

    DCBindingContainer bindings =
    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    DCIteratorBinding dcItteratorBindings =
    bindings.findIteratorBinding("EmpTableVO1Iterator");
    ViewObject voTableData = dcItteratorBindings.getViewObject();
    Row rowSelected = voTableData.getCurrentRow();

    String Empname =rowSelected.getAttribute("EmpName").toString();
    String Empno =rowSelected.getAttribute("EmpNo").toString();
    String Comm =rowSelected.getAttribute("Comm").toString();
    String Manager =rowSelected.getAttribute("Manager").toString();

    System.out.println("Emp Name selected is:"+Empname);
    System.out.println("Emp No selected is:"+Empno);
    System.out.println("Comm selected is:"+Comm);
    System.out.println("Manager selected is:"+Manager);
    }

    Now the issue is for suppose table has 20 rows if i click on the 15th row(click on the EmpNo of 15th row) then the row values returned in the Link1() method belongs to First row.
    if i click on any row but the values returned in the Link1() method are belongs to first row only.

    I should use commandLink only and on clicking on that link(Any EmpNo) i need to pass values(the current ) and call other page but im not getting current row values so printing here after i get i will add the remaining code.

    How to get the values of current row clicked???

    i hope u got my requirement. i should do it through commandlink click only.


    thanks.

    Edited by: Kumar on Dec 13, 2012 5:38 PM
  • 17. Re: Not getting selected row values on commnadLink click???
    Mohammad Jabr Guru
    Currently Being Moderated
    Hi Kumar,
    I have tested your case in Jdeveloper 11.1.2.3.0, and it works successfully.

    here is my page source:
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <af:document title="untitled2.jsf" id="d1">
        <af:messages id="m1"/>
        <af:form id="f1">
          <af:table value="#{bindings.EmployeesView1.collectionModel}" var="row" rows="#{bindings.EmployeesView1.rangeSize}"
                    emptyText="#{bindings.EmployeesView1.viewable ? 'No data to display.' : 'Access Denied.'}"
                    fetchSize="#{bindings.EmployeesView1.rangeSize}" rowBandingInterval="0"
                    selectedRowKeys="#{bindings.EmployeesView1.collectionModel.selectedRow}"
                    selectionListener="#{bindings.EmployeesView1.collectionModel.makeCurrent}" rowSelection="single"
                    id="t1">
            <af:column sortProperty="#{bindings.EmployeesView1.hints.EmployeeId.name}" sortable="false"
                       headerText="#{bindings.EmployeesView1.hints.EmployeeId.label}" id="c1">
              <af:commandLink text="#{row.bindings.EmployeeId.inputValue}" id="cl1" action="#{Test.getRowInformation}"/>
            </af:column>
            <af:column sortProperty="#{bindings.EmployeesView1.hints.FirstName.name}" sortable="false"
                       headerText="#{bindings.EmployeesView1.hints.FirstName.label}" id="c2">
              <af:inputText value="#{row.bindings.FirstName.inputValue}"
                            label="#{bindings.EmployeesView1.hints.FirstName.label}"
                            required="#{bindings.EmployeesView1.hints.FirstName.mandatory}"
                            columns="#{bindings.EmployeesView1.hints.FirstName.displayWidth}"
                            maximumLength="#{bindings.EmployeesView1.hints.FirstName.precision}"
                            shortDesc="#{bindings.EmployeesView1.hints.FirstName.tooltip}" id="it2">
                <f:validator binding="#{row.bindings.FirstName.validator}"/>
              </af:inputText>
            </af:column>
            <af:column sortProperty="#{bindings.EmployeesView1.hints.LastName.name}" sortable="false"
                       headerText="#{bindings.EmployeesView1.hints.LastName.label}" id="c3">
              <af:inputText value="#{row.bindings.LastName.inputValue}"
                            label="#{bindings.EmployeesView1.hints.LastName.label}"
                            required="#{bindings.EmployeesView1.hints.LastName.mandatory}"
                            columns="#{bindings.EmployeesView1.hints.LastName.displayWidth}"
                            maximumLength="#{bindings.EmployeesView1.hints.LastName.precision}"
                            shortDesc="#{bindings.EmployeesView1.hints.LastName.tooltip}" id="it3">
                <f:validator binding="#{row.bindings.LastName.validator}"/>
              </af:inputText>
            </af:column>
          </af:table>
        </af:form>
      </af:document>
    </f:view>
    and the page definition file is
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel" version="11.1.2.62.76" id="untitled2PageDef"
                    Package="view.pageDefs">
      <parameters/>
      <executables>
        <variableIterator id="variables"/>
        <iterator Binds="EmployeesView1" RangeSize="25" DataControl="AppModuleDataControl" id="EmployeesView1Iterator"/>
      </executables>
      <bindings>
        <tree IterBinding="EmployeesView1Iterator" id="EmployeesView1">
          <nodeDefinition DefName="model.vo.EmployeesView" Name="EmployeesView10">
            <AttrNames>
              <Item Value="EmployeeId"/>
              <Item Value="FirstName"/>
              <Item Value="LastName"/>
            </AttrNames>
          </nodeDefinition>
        </tree>
      </bindings>
    </pageDefinition>
    and the managed bean is
    package view;
    
    import oracle.adf.model.BindingContext;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.adf.model.binding.DCIteratorBinding;
    
    import oracle.binding.BindingContainer;
    import oracle.binding.OperationBinding;
    
    import oracle.jbo.Row;
    
    public class Test
    {
      public Test()
      {
      }
     
      public String getRowInformation()
      {
        // Add event code here...
        DCBindingContainer dcBindingContainer = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
        DCIteratorBinding iter = dcBindingContainer.findIteratorBinding("EmployeesView1Iterator");
        Row currentRow = iter.getCurrentRow();
        System.out.println("Employee First Name " + currentRow.getAttribute("FirstName"));
    
        return null;
      }
     
      
    }
    check what is missing in your application.
  • 18. Re: Not getting selected row values on commnadLink click???
    872999 Newbie
    Currently Being Moderated
    take your table's properties ->advanced tab -> binding -> edit -> select ur required bean from drop down -> give a name to ur variable say t1.

    now in your method of your bean, gett1() will give your table component.
    gettt1().getrowdata() give ur currect row of table.


    by this method you will get only atttributes defined in node definition of table(tree) binding defined in your page def.
    But by methods suggested above by Jabr using iterator or vo, you can get all attributes. so that is a better way than mine.

    Edited by: josetuttu on Dec 13, 2012 5:43 AM
  • 19. Re: Not getting selected row values on commnadLink click???
    925715 Explorer
    Currently Being Moderated
    Hi Jabr,

    the code u provided is for single row selection property in ADF.
    But in my case i have first column as commandLink and on clicking on any EmpNo(commandLink) action "link1()" method will be called, in which im selecting the values of current row.

    what can be done for this?
  • 20. Re: Not getting selected row values on commnadLink click???
    Mohammad Jabr Guru
    Currently Being Moderated
    >
    the code u provided is for single row selection property in ADF.
    But in my case i have first column as commandLink and on clicking on any EmpNo(commandLink) action "link1()" method will be called, in which im selecting the values of current row.
    >

    This exactly what the code does.
    Did you try it?
  • 21. Re: Not getting selected row values on commnadLink click???
    925715 Explorer
    Currently Being Moderated
    Thanks for ur support all of u.
    i got the exact solution when i tried which Jabr specified.
    Thanks once again.
1 2 Previous Next

Legend

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