[ 
https://issues.apache.org/jira/browse/WICKET-6587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16619504#comment-16619504
 ] 

ASF GitHub Bot commented on WICKET-6587:
----------------------------------------

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.


> CheckBoxSelector should accept more CheckBoxes to be added later
> ----------------------------------------------------------------
>
>                 Key: WICKET-6587
>                 URL: https://issues.apache.org/jira/browse/WICKET-6587
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket-core
>    Affects Versions: 8.0.0, 7.10.0
>            Reporter: Carl-Eric Menzel
>            Assignee: Carl-Eric Menzel
>            Priority: Major
>
> CheckBoxSelector currently only allows attaching CheckBoxes at construction 
> time. Sometimes additional CheckBoxes may need to be added later.
> I'm preparing a patch for this.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to