5 Replies Latest reply on Oct 27, 2010 10:00 AM by Leo K

    add action to a UISelectItem (RF 333)

    Leo K Newbie

      Hi

       

      I am generating programatically a list of options.

       

      I can set an ajax action to the whole component just like this

       

              HtmlSelectManyCheckbox list = (HtmlSelectManyCheckbox)application.createComponent(HtmlSelectManyCheckbox.COMPONENT_TYPE);
             
              ValueExpression listaMultiBinding = exprFactory.createValueExpression(elContext,"#{test.value.list}",String.class);
              list.setValueExpression("value", listaMultiBinding);
             
              UISelectItems selectItems = (UISelectItems)application.createComponent(UISelectItems.COMPONENT_TYPE);
              List<SelectItem> options = new ArrayList<SelectItem>();
             
              for(int i=0;i<10;i++){
                  options.add(new SelectItem(i, "option #"+i));   
              }
             
      //        UISelectItem item1 = (UISelectItem)application.createComponent(UISelectItem.COMPONENT_TYPE);
             
              selectItems.setValue(options);
              list.getChildren().add(selectItems);
             
              UIAjaxSupport ajax2 =(UIAjaxSupport)application.createComponent(UIAjaxSupport.COMPONENT_TYPE);
              ajax2.setEvent("onchange");
              ajax2.setActionExpression(...);
              list.getChildren().add(ajax2);
             
              children.add(list);

       

      What I want is to enable/disable other components in the same screen, according to each option selected. They´re also dynamically generated.

       

      What´s the best way for this? Is there any way to bind actions to each option instead to the whole HtmlSelectManyCheckbox?

       

      TIA

       

      Leo