3 Replies Latest reply on Jul 5, 2013 10:57 AM by Richard Childe

    ADF Mobile - selectBooleanCheckbox on a listItem?

    Richard Childe

      JDeveloper/ADF Mobile




      I'm just wondering if it's possible to add a selectBooleanCheckBox to a listItem, and then programatically associate a select/de-select of it to an item of data on the same listItem? I have a listView built from a web service data control. (I'm using trying to use a listView rather than a selectManyCheckBox because they only seem to be able to display one item of text data and nothing else). I thought it would be easy as when you select the checkBox in the app, the whole listItem does appear to get selected and property listeners on the listItem get fired, but the valueChangeEvent listener for the checkbox gets fired first and so the correct value in the property listener isn't available in the checkBox bean. I've tried obtaining it from the binding layer but it seems the iterator doesn't move.


      I've tried everything else I can think of but am out of ideas. Has anyone managed to do this? Any tips would be really appreciated.



        • 1. Re: ADF Mobile - selectBooleanCheckbox on a listItem?
          Frank Nimphius-Oracle



          never tried but I can imagine that this requires a transient attribute to hold the check box state. To implement this you could rap the WS DC call in a POJO and have the POJO exposing a collection that has an additional field (selectBooleanState). This way the field would be updated with the checkbox selection and you would get the select state information from the list item listener



          1 person found this helpful
          • 2. Re: ADF Mobile - selectBooleanCheckbox on a listItem?
            Richard Childe

            Hi Frank,




            I've managed to set/un-set the checkboxes as part of a database query in the exact way you've just described. That works fine for the initial display, but the problem then is that there's no way to associate which checkbox a user selects with the containing listItem.




            I'm trying to achieve this sort of thing which is very common in mobile apps, but doesn't seem possible in ADF mobile (the left image):








            I don't know if this forum is the right place to suggest ADF mobile enhancements, but is it possible that the selectManyCheckbox UI component be expanded to allow a little more visual customization (icons, more text etc?).




            Thanks, Rich,

            • 3. Re: ADF Mobile - selectBooleanCheckbox on a listItem?
              Richard Childe

              Hello again,




              I think I've managed to concoct a solution to this - it's a bit of a kludge but I'll post it here in case anyone's interested.




              When you select a checkbox that sits on a listItem, both ActionListeners (for the checkBox and the listItem) are fired. So in the checkBox bean class, define 2 static variables - one to act as a flag to record the fact that the checkBox has been hit, and one to save the selected/un-selected boolean state. Set these accordingly in the checkBox valueChangeEvent method. Then in the listItem ActionEvent method (same class as the checkBox), check the flag to see if the checkBox has been hit, retrieve any data required from the property listeners, get the checkbox state (selected/unselected), and reset the flag at the end. This way you can distinguish if the checkBox was selected or not as opposed to an accidental click of the listItem, and gives you access to the data on the listItem, so the overall result is like a selectManyCheckBox UI component that's a lot more configurable.




              I'm sure there's a more elegant solution this, but it works anyway.