You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jeffrey Schneller <je...@envisa.com> on 2010/03/09 21:21:01 UTC

Palette filtering available list

How can I filter the available list in a palette?  I have a dropdown to
specify the filter and I can retrieve the filtered list from my data
access.  How do I set the available list in the palette to be my new
filtered list?

 

Here is my code for creating the palette and also the filter button that
is going to do the filtering.  I can get the definedChoices.  The
problem I am having is what needs to go between the comments.

 

Thanks for any help.

 

List<Items> definedChoices = dao.findItems();

                IChoiceRenderer renderer = new
ItemChoiceRenderer("name", "value");

                final Palette palette = new Palette("values", new
Model((Serializable)definedChoices), renderer, 10, true);

                palette.setMarkupId("values");

                palette.setOutputMarkupId(true);

                 palette.setOutputMarkupPlaceholderTag(true);

                 add(palette);

 

                AjaxButton filterButton = new AjaxButton("filter") {

                                @Override

                                protected void
onSubmit(AjaxRequestTarget target, Form<?> form) {

                                                String product =
productDropDown.getValue();

                                                String type =
typeDropDown.getValue();

                                                                

                                                List<Item>
definedChoices = dao.findItemsByFilter(product, type);

                                                 //
**********************************

                                                // HOW DO I SET THE
AVAILABLE LIST FOR THE PALETTE???           

                                                //
***********************************

 
target.addComponent(palette);

                                }

                };

                filterButton.setDefaultFormProcessing(false);

                add(filterButton);


Re: Palette filtering available list

Posted by Igor Vaynberg <ig...@gmail.com>.
use a detachable model for the options collection

-igor

On Tue, Mar 9, 2010 at 12:21 PM, Jeffrey Schneller
<je...@envisa.com> wrote:
> How can I filter the available list in a palette?  I have a dropdown to
> specify the filter and I can retrieve the filtered list from my data
> access.  How do I set the available list in the palette to be my new
> filtered list?
>
>
>
> Here is my code for creating the palette and also the filter button that
> is going to do the filtering.  I can get the definedChoices.  The
> problem I am having is what needs to go between the comments.
>
>
>
> Thanks for any help.
>
>
>
> List<Items> definedChoices = dao.findItems();
>
>                IChoiceRenderer renderer = new
> ItemChoiceRenderer("name", "value");
>
>                final Palette palette = new Palette("values", new
> Model((Serializable)definedChoices), renderer, 10, true);
>
>                palette.setMarkupId("values");
>
>                palette.setOutputMarkupId(true);
>
>                 palette.setOutputMarkupPlaceholderTag(true);
>
>                 add(palette);
>
>
>
>                AjaxButton filterButton = new AjaxButton("filter") {
>
>                                @Override
>
>                                protected void
> onSubmit(AjaxRequestTarget target, Form<?> form) {
>
>                                                String product =
> productDropDown.getValue();
>
>                                                String type =
> typeDropDown.getValue();
>
>
>
>                                                List<Item>
> definedChoices = dao.findItemsByFilter(product, type);
>
>                                                 //
> **********************************
>
>                                                // HOW DO I SET THE
> AVAILABLE LIST FOR THE PALETTE???
>
>                                                //
> ***********************************
>
>
> target.addComponent(palette);
>
>                                }
>
>                };
>
>                filterButton.setDefaultFormProcessing(false);
>
>                add(filterButton);
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org