Version of Smart GWT is 12.1-p20200709
Scenario is we have 2 list of button inside 2 layouts
list 1 -> samsung, sony, mi
list 2 -> tv, phone, ac
there are 2 buttons: brand and type
on click of brand button:
list 1 will be as radio group (single selection)
list 2 will be checkbox (multiple selection)
on click of type button:
list 1 will be checkbox (multiple selection)
list 2 will be radio group (single selection)
below is my code to create and switch buttons:
create radio button for brand list
IButton getRadioButton(String id, String title) {
IButton button = new IButton();
button.setTitle(title);
button.setID(id);
button.setRadioGroup("grp1");
button.setActionType(SelectionType.RADIO);
return button;
}
create checkbox button for type list
IButton createCheckboxButton(String id, String title) {
IButton button = new IButton();
button.setTitle(title);
button.setID(id);
button.setActionType(SelectionType.CHECKBOX);
return button;
}
then on type button click i am removing radio group for brand list and converting to checkbox and adding radio group to type list and converting to radio
typeButtons.stream().forEach(b -> {
b.setRadioGroup("grp1");
b.setActionType(SelectionType.RADIO);
});
brandButtons.stream().forEach(b -> {
b.removeFromRadioGroup();
b.setActionType(SelectionType.CHECKBOX);
});
but i am receiving all button as checkbox as both list of buttons have multiple selection.
Scenario is we have 2 list of button inside 2 layouts
list 1 -> samsung, sony, mi
list 2 -> tv, phone, ac
there are 2 buttons: brand and type
on click of brand button:
list 1 will be as radio group (single selection)
list 2 will be checkbox (multiple selection)
on click of type button:
list 1 will be checkbox (multiple selection)
list 2 will be radio group (single selection)
below is my code to create and switch buttons:
create radio button for brand list
IButton getRadioButton(String id, String title) {
IButton button = new IButton();
button.setTitle(title);
button.setID(id);
button.setRadioGroup("grp1");
button.setActionType(SelectionType.RADIO);
return button;
}
create checkbox button for type list
IButton createCheckboxButton(String id, String title) {
IButton button = new IButton();
button.setTitle(title);
button.setID(id);
button.setActionType(SelectionType.CHECKBOX);
return button;
}
then on type button click i am removing radio group for brand list and converting to checkbox and adding radio group to type list and converting to radio
typeButtons.stream().forEach(b -> {
b.setRadioGroup("grp1");
b.setActionType(SelectionType.RADIO);
});
brandButtons.stream().forEach(b -> {
b.removeFromRadioGroup();
b.setActionType(SelectionType.CHECKBOX);
});
but i am receiving all button as checkbox as both list of buttons have multiple selection.
Comment