5 Replies Latest reply: Apr 18, 2013 7:55 AM by 977007 RSS

    Trouble in accessing  table contents using select boolean checkbox.

    997118
      Hi all . i am using jdeveloper 11.1.1.6.0
      In my jspx page i have only one table and a input text box .
      table is created by a VO which has three contents like empno,empname,sal
      i added the extra column in the table for a select boolean checkbox.
      my requirement is , whenever i select the checkbox the corresponding salary should be added in the
      textbox, when i unselect the checkbox, the corresponding value should be subtracted from the textbox dynamically
      its urgent . plz help in java coding.

      Edited by: 994115 on Apr 18, 2013 2:15 AM
        • 1. Re: Trouble in accessing  table contents using select boolean checkbox.
          Frank Nimphius-Oracle
          Hi,

          if the table is configured for single row selection, then you can get this information from the ADF binding. For this, in the PageDef file, create an attribute binding for the Salary attribute of the iterator used by the table. To access the salary value you then call

          BindingContext bctx = BindingContext.getCurrent();
          BindingContainer bindings = bctx.getCurrentBindingEntry();
          AttributeBinding salaryBinding = (AttributeBinding) bindings.get("Salary");
          Oracle.jbo.domain.Number salaryValue = (Oracle.jbo.domain.Number) salaryBinding .getInputValue();

          Ps.: If the Salary is not of type oracle.jbo.domain.Number, then change the code above

          Frank
          • 2. Re: Trouble in accessing  table contents using select boolean checkbox.
            997118
            yes my table is configured with single row selection.
            may i know where to put this coding.
            i tried to place that coding in java file of my jspx page .

            public void setSbc1(RichSelectBooleanCheckbox sbc1) {
            this.sbc1 = sbc1;
            }

            public RichSelectBooleanCheckbox getSbc1() {
            BindingContext bctx = BindingContext.getCurrent();
            BindingContainer bindings = bctx.getCurrentBindingEntry();
            AttributeBinding salaryBinding = (AttributeBinding) bindings.get("Salary");
            Oracle.jbo.domain.Number salaryValue = (Oracle.jbo.domain.Number) salaryBinding .getInputValue();


            }
            is this correct . coz i got error

            Edited by: 994115 on Apr 18, 2013 4:46 AM
            • 3. Re: Trouble in accessing  table contents using select boolean checkbox.
              977007
              Register one value change listener with SelectBooleanCheckbox and into it write this code.
              So that you will able to get the salary value of current selected row.

              - Viral
              • 4. Re: Trouble in accessing  table contents using select boolean checkbox.
                997118
                Will this coding ll do the functionality i required?

                my functionality :

                consider 4 datas ,

                1st salary : 3000
                2ns salary: 4000
                3rd salary: 2000
                4th salary: 3000

                my page doest have a single button. its purely on checkbox click . i ve given autosubmit-=true
                when i select first checkbox 3000 should appear in the textbox
                when i check the 2nd checkbox, 7000 should appear
                when i check the 4th checkbox , 10000 should appear
                again when i uncheck the 2nd checkbox ,value should be subtracted and the textbox should contain 6000
                • 5. Re: Trouble in accessing  table contents using select boolean checkbox.
                  977007
                  find code snippet here...
                    <af:table value="#{bindings.EmployeeView.collectionModel}"
                                        var="row" rows="#{bindings.EmployeeView.rangeSize}"
                                        emptyText="#{bindings.EmployeeView.viewable ? 'No data to display.' : 'Access Denied.'}"
                                        fetchSize="#{bindings.EmployeeView.rangeSize}"
                                        rowBandingInterval="0" id="t1">
                  
                  
                     
                     <af:column sortable="false"
                                               headerText="#{bindings.EmployeeView.hints.SelectYn.label}"
                                               id="c85">
                                      <af:selectBooleanCheckbox 
                                                                label="#{row.bindings.SelectYn.label}" value="#{row.bindings.SelectYn.inputValue}" autoSubmit="true"
                                                                                              valueChangeListener="#{pageFlowScope.EmpPageBean.selectedValueChanged}"
                                                                id="sbc2"/>
                                    </af:column>
                              ....
                              ...
                              ...
                              
                  in backing bean....
                               
                                  
                                  public void selectedValueChanged(ValueChangeEvent valueChangeEvent) {
                  
                         boolean newValue = (Boolean)valueChangeEvent.getNewValue();
                  
                  
                       BindingContext bctx = BindingContext.getCurrent();
                  BindingContainer bindings = bctx.getCurrentBindingEntry();
                  AttributeBinding salaryBinding = (AttributeBinding) bindings.get("Salary");
                  Oracle.jbo.domain.Number salaryValue = (Oracle.jbo.domain.Number) salaryBinding .getInputValue();
                  
                  
                       if (newValue){
                       
                       // get the inputbox value and add value into inputbox...
                  
                       }
                  
                       else
                       {
                       // get the inputbox value and substract value from inputbox...
                  
                       
                       }
                  
                  }
                  
                  //add partial target to refresh the inputtext
                  
                   AdfFacesContext.getCurrentInstance().addPartialTarget(tipt); // here tipt is the backing bean binging of inputtext
                  or
                  alternatively you can add partialTriggers="sbc2" to your inputtext.


                  - Viral