Github user svenmeier commented on the issue:

    https://github.com/apache/wicket/pull/292
  
    Why not add a lookup to CheckBoxSelector instead:
    
    ```
    public CheckBoxSelector(String id, CheckBox... boxes)
    {
        super(id);
    
        connectedCheckBoxes = boxes;
    }
    
    /**
     * Override if you need want the boxes to be collected dynamically.
     */
    protected List<Check> getCheckBoxes() {
        return Arrays.asList(connectedCheckBoxes);
    }
    
    @Override
    protected CharSequence getFindCheckboxesFunction()
    {
        return 
String.format("Wicket.CheckboxSelector.getCheckboxesFunction(%s)",
                buildMarkupIdJSArrayLiteral(getCheckBoxes()));
    }
    ```
    No need to hold references to all checkboxes, with the possibility of 
leakage when one is removed.


---

Reply via email to