3 Replies Latest reply: Oct 4, 2013 2:26 AM by 974390 RSS

    ADF Mobile- Retreive value of a row on selection of Boolean Checkbox

    974390

      Hi,

      I have a requirement wherein i have a list item on amx page.On click of any row of the list item it navigates to different page .Now i need to add a boolean checkbox in the list wherein on it's selection different operations should take place, but in my case i'm facing some few challenges:

       

      1)When clicked on checkbox it navigates to different pages as per navigation added on list item .

      2) On selection of checkbox whole row value should get selected and on click of delete button it should get deleted.

       

      Is there any way to acheive it.Any help would be appreciated.

       

      Thanks,

      Gyani

        • 1. Re: ADF Mobile- Retreive value of a row on selection of Boolean Checkbox
          Richard Childe

          Hi,

           

           

           

          I had a similar requirement, and managed to come up with a solution that exploits the fact that when you select a checkbox that sits on a listItem, both ActionListeners (for the checkBox and the listItem) are fired. If you read my last post at the end of this thread, there's a basic explanation of how it works:

           

           

           

          https://forums.oracle.com/thread/2557353

           

           

           

          Hope this helps,

           

           

          Rich.

          • 2. Re: ADF Mobile- Retreive value of a row on selection of Boolean Checkbox
            974390

            I appreciate your help,  as i am new to ADF mobile can you please help with any workaround   that has to done in Bean class for selection/de-selection of checkbox.

            • 3. Re: ADF Mobile- Retreive value of a row on selection of Boolean Checkbox
              974390

              Hi,

              I went through the post as mentioned in https://forums.oracle.com/thread/2557353, i was not able to infer much out of it as i'm completely new to ADF Mobile.According to my understanding i have :

              1)Added a column in database as chechboxflag of  VARCHAR(2)

              2) Used getter and setter for this column in java class

              3)Dropped this column as Boolean Checkbox with SelectedValue as Y and Unselected as N

               

              <amx:selectBooleanCheckbox value="#{bindings.flag.inputValue}"  valueChangeListener="#{viewScope.Checkbox.getCheckboxValue}" id="sbc1"

                                                       inlineStyle="margin:0px 0px -20px -29px;"/>

               

              4)ValueChangeListerener of that Checkbox is associated with a Managed Bean class.

              Below is the snippet of the code written in Managed Bean class:

               

                  public void getCheckboxValue(ValueChangeEvent valueChangeEvent) {

                      ValueExpression ve =AdfmfJavaUtilities.getValueExpression("#{viewScope.flag}",String.class);   

                                        ve.setValue(AdfmfJavaUtilities.getAdfELContext(), "Value Changed!");

               

               

                           

                                                 

                              Trace.log(Utility.ApplicationLogger, Level.INFO, Checkbox.class, "ValueChangeHandler",

                                   "##############Inside ValueChangeHandler");

                              AmxAttributeBinding attrBinding = (AmxAttributeBinding) ve.getValue(AdfmfJavaUtilities.getAdfELContext());

                                                  AmxIteratorBinding amxListIterator = attrBinding.getIteratorBinding();

                                                  BasicIterator listIterator =  (BasicIterator)amxListIterator.getCurrentRow();

                              //                           RowIterator ri = listIterator.getCurrentIndex()("flag")

                             

                              boolean isSelected = ((Boolean)valueChangeEvent.getNewValue()).booleanValue();

                             

                                               int i = 0;

                                          Row row = null;

                        

                              //                    //            System.out.println("Changing row 1: " +

                              //                    //              row.getAttribute("Name"));

                                          System.out.println("xdebug c2: Changing row 2: " +

                                          row.getAttribute("Flag"));

                             

                                          if(isSelected)

                                          row.setAttribute("Flag", "Y");

                                          else

                                          row.setAttribute("Flag", "N");

                                          i++;

                                          }

                                          }

                             

               

               

               

               

               

               

                       //   private DCBindingContainer getBindings() {

                        /      return (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();

                     

                      //    }

                     

                  //    }

               

              But when i click on my checkbox it throws error saying Error : Unable to invoke method getCheckboxValue() in mobile.Checkbox class.

               

              Please let me where am i going wrong, any help would be appreciated.

               

              Thanks