At the gate, how can I create RadioGroups that are not defined by the component hierarchy / layout?

I use Wicket and would like to create a grid of radio buttons using HTML, as shown below (external lists will be displayed vertically, internal lists will be displayed horizontally).

The number of groups is variable - it can be ABC, ABCD, ABCDE, etc.

I would like the switches to be grouped vertically.

<ul>
  <li>
    <ul>
       <li><input type="radio" name="A"></li>
       <li><input type="radio" name="B"></li>
       <li><input type="radio" name="C"></li>
    </ul>
  </li>
  <li>
    <ul>
       <li><input type="radio" name="A"></li>
       <li><input type="radio" name="B"></li>
       <li><input type="radio" name="C"></li>
    </ul>
  </li>
  <li>
    <ul>
       <li><input type="radio" name="A"></li>
       <li><input type="radio" name="B"></li>
       <li><input type="radio" name="C"></li>
    </ul>
  </li>
</ul>

Unfortunately, it seems that it RadioGroupallows you to group radio buttons in accordance with the grouping defined by their layout.

eg:.

RadioGroup group = new RadioGroup("radioGroupA");

group.add( new Radio("myradio", new Model(1)) ;

The problem is that I cannot lay out the elements the way I want.

Is there another way? Manually specify a name and collect results?

UPDATE: , Radio RadioGroup . - :

// create some groups
for (0..n) {
  RadioGroup group = new RadioGroup("myRadioGroup", new Model { .. } );
  groupArray.add(group)
}

//create a ListView for the RadioGroups so we can attach them to page
ListView radioListView = ListView("radioGroupList") { populate from groupArray }
add(radioListView);

// create our grid of radio buttons
// outer -> rows 
for (0..x) {
  // inner -> columns
  for (0..n)
    // supply group from our groupArray
    add( new Radio("myradio", new Model(1), groupArray.get(n) ));
  }
}

Radio RadioGroup , .

<form>
  <span wicket:id="radioGroupList">
     <span wicket:id="radioGroup"/>
  </span>
  <ul> 
    <li><radio wicket:id="myradio"/></li>

, , :

WicketMessage: http post [radio33] RadioGroup [2: tContainer: list: 2: tPanel: myForm: orderedRadioGroupList: 0: orderedRadioGroup] , . RadioGroup Radio, . , .

, ?

"" , .

Wicket 1.4.12.

Apache, : https://issues.apache.org/jira/browse/WICKET-1055

+5
2

. , javadoc. , , Radio RadioGroup . :

<span wicket:id="group1">
    <span wicket:id="group2">
        <span wicket:id="group3">
            <ul>
                <li><input wicket:id="radio" type="radio"/>
                ...

, ListView, RadioGroups, . .

+3

: Cheers, andre

JAVA:

RadioChoice<String> choice = new RadioChoice<>(
    "logger", new PropertyModel<>(model, "impl"), dao.getAvailableLoggers()
);
choice.setSuffix("\n");
form.add(choice);

:

<style type="text/css">
    .nowrap, .nowrap label {
        display: inline-block;
    }
</style>

<div class="nowrap">
    <wicket:container wicket:id="logger">x</wicket:container>
</div>
0

All Articles