[Oracle ADF] SelectOneChoice и RichSelectOneChoice



Sample:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<af:selectOneChoice label="Без Сортировки" id="soc1" styleClass="page-title"
                    mode="compact" simple="true"
                    value="0" autoSubmit="true"
                    valueChangeListener="#{TasksFilterBean.onTasksFilterDateChanged}">
  <af:selectItem label="Без Сортировки" value="0"
                 id="si0"/>
  <af:selectItem label="Текущий день" value="1"
                 id="si1"/>
  <af:selectItem label="Вчера" value="2"
                 id="si2"/>
  <af:selectItem label="Эта неделя" value="3"
                 id="si3"/>
  <af:selectItem label="Текущий месяц" value="4"
                 id="si4"/>
  <af:selectItem label="Текущий квартал" value="5"
                 id="si5"/>
</af:selectOneChoice>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
public void onTasksFilterDateChanged (ValueChangeEvent valueChangeEvent) {

    System.out.println("===========================");
    System.out.println(valueChangeEvent.getNewValue());
    System.out.println("===========================");


// Or

    RichSelectOneChoice soc = (RichSelectOneChoice)valueChangeEvent.getComponent();
    String var1 = soc.getValue().toString();


}



SOC can return value or index.

1
2
3
    System.out.println("");
    System.out.println(valueChangeEvent.getNewValue().toString());
    System.out.println("");

To chose it, Bindings –> pageDef.

Parameter: SelectItemValueMode: {ListObject, LixtIndex}



Samples: