You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "david.li" <lx...@hotmail.com> on 2012/11/20 05:24:21 UTC

how to get the listview's dropdownchoice value

the code like this:
List<String> selection = Arrays.asList("A", "B");
form.add(new ListView("lis", selection) {

	@Override
	protected void populateItem(ListItem item) {
		List list;
		if (item.getModelObject().equals("A")) {
			list = Arrays.asList("a1", "a2");
		} else {
			list = Arrays.asList("b1", "b2");
		}
		DropDownChoice ddl = new DropDownChoice("ddltest", ddlmodel, list);
		item.add(ddl);
	}

});



-----
david
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-get-the-listview-s-dropdownchoice-value-tp4654012.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: how to get the listview's dropdownchoice value

Posted by "david.li" <lx...@hotmail.com>.
Thanks for your help.


Martin Grigorov-4 wrote
> List
> <IModel>
>  ddlmodels = ....
> List
> <String>
>  selection = Arrays.asList("A", "B");
> form.add(new ListView("lis", selection) {
> 
>         @Override
>         protected void populateItem(ListItem item) {
>                 List list;
>                 if (item.getModelObject().equals("A")) {
>                         list = Arrays.asList("a1", "a2");
>                 } else {
>                         list = Arrays.asList("b1", "b2");
>                 }
>                 DropDownChoice ddl = new DropDownChoice("ddltest",
> ddlmodels.get(item.getIndex()), list);
>                 item.add(ddl);
>         }
> 
> });
> 
> 
> On Tue, Nov 20, 2012 at 10:49 AM, david.li &lt;

> lxw_first@

> &gt; wrote:
> 
>> you said need a separate ddlmodel for each DropDownChpice.
>> How to implement it in ListView?
>>
>> Can you give me a sample?
>> Thanks.
>>
>>
>> Martin Grigorov-4 wrote
>> > You need a separate ddlmodel for each DDC.
>> > Currently you are passing the same backend to all DDCs and they
>> override
>> > its value.
>> >
>> >
>> > On Tue, Nov 20, 2012 at 10:19 AM, david.li <
>>
>> > lxw_first@
>>
>> > > wrote:
>> >
>> >> Through the ddlmodel.getObject() just get the value of the last
>> >> DropDownChoice,but I want to get the value of the all DropDownChoice.
>> >>
>> >>
>> >>
>> >> -----
>> >> david
>> >> --
>> >> View this message in context:
>> >>
>> http://apache-wicket.1842946.n4.nabble.com/how-to-get-the-listview-s-dropdownchoice-value-tp4654012p4654016.html
>> >> Sent from the Users forum mailing list archive at Nabble.com.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail:
>>
>> > users-unsubscribe@.apache
>>
>> >> For additional commands, e-mail:
>>
>> > users-help@.apache
>>
>> >>
>> >>
>> >
>> >
>> > --
>> > Martin Grigorov
>> > jWeekend
>> > Training, Consulting, Development
>> > http://jWeekend.com &lt;http://jweekend.com/&gt;
>>
>>
>>
>>
>>
>> -----
>> david
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/how-to-get-the-listview-s-dropdownchoice-value-tp4654012p4654020.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: 

> users-unsubscribe@.apache

>> For additional commands, e-mail: 

> users-help@.apache

>>
>>
> 
> 
> -- 
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com &lt;http://jweekend.com/&gt;





-----
david
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-get-the-listview-s-dropdownchoice-value-tp4654012p4654056.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: how to get the listview's dropdownchoice value

Posted by Martin Grigorov <mg...@apache.org>.
List<IModel> ddlmodels = ....
List<String> selection = Arrays.asList("A", "B");
form.add(new ListView("lis", selection) {

        @Override
        protected void populateItem(ListItem item) {
                List list;
                if (item.getModelObject().equals("A")) {
                        list = Arrays.asList("a1", "a2");
                } else {
                        list = Arrays.asList("b1", "b2");
                }
                DropDownChoice ddl = new DropDownChoice("ddltest",
ddlmodels.get(item.getIndex()), list);
                item.add(ddl);
        }

});


On Tue, Nov 20, 2012 at 10:49 AM, david.li <lx...@hotmail.com> wrote:

> you said need a separate ddlmodel for each DropDownChpice.
> How to implement it in ListView?
>
> Can you give me a sample?
> Thanks.
>
>
> Martin Grigorov-4 wrote
> > You need a separate ddlmodel for each DDC.
> > Currently you are passing the same backend to all DDCs and they override
> > its value.
> >
> >
> > On Tue, Nov 20, 2012 at 10:19 AM, david.li <
>
> > lxw_first@
>
> > > wrote:
> >
> >> Through the ddlmodel.getObject() just get the value of the last
> >> DropDownChoice,but I want to get the value of the all DropDownChoice.
> >>
> >>
> >>
> >> -----
> >> david
> >> --
> >> View this message in context:
> >>
> http://apache-wicket.1842946.n4.nabble.com/how-to-get-the-listview-s-dropdownchoice-value-tp4654012p4654016.html
> >> Sent from the Users forum mailing list archive at Nabble.com.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail:
>
> > users-unsubscribe@.apache
>
> >> For additional commands, e-mail:
>
> > users-help@.apache
>
> >>
> >>
> >
> >
> > --
> > Martin Grigorov
> > jWeekend
> > Training, Consulting, Development
> > http://jWeekend.com <http://jweekend.com/>
>
>
>
>
>
> -----
> david
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/how-to-get-the-listview-s-dropdownchoice-value-tp4654012p4654020.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: how to get the listview's dropdownchoice value

Posted by "david.li" <lx...@hotmail.com>.
you said need a separate ddlmodel for each DropDownChpice.
How to implement it in ListView?

Can you give me a sample?
Thanks.


Martin Grigorov-4 wrote
> You need a separate ddlmodel for each DDC.
> Currently you are passing the same backend to all DDCs and they override
> its value.
> 
> 
> On Tue, Nov 20, 2012 at 10:19 AM, david.li &lt;

> lxw_first@

> &gt; wrote:
> 
>> Through the ddlmodel.getObject() just get the value of the last
>> DropDownChoice,but I want to get the value of the all DropDownChoice.
>>
>>
>>
>> -----
>> david
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/how-to-get-the-listview-s-dropdownchoice-value-tp4654012p4654016.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: 

> users-unsubscribe@.apache

>> For additional commands, e-mail: 

> users-help@.apache

>>
>>
> 
> 
> -- 
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com &lt;http://jweekend.com/&gt;





-----
david
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-get-the-listview-s-dropdownchoice-value-tp4654012p4654020.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: how to get the listview's dropdownchoice value

Posted by Martin Grigorov <mg...@apache.org>.
You need a separate ddlmodel for each DDC.
Currently you are passing the same backend to all DDCs and they override
its value.


On Tue, Nov 20, 2012 at 10:19 AM, david.li <lx...@hotmail.com> wrote:

> Through the ddlmodel.getObject() just get the value of the last
> DropDownChoice,but I want to get the value of the all DropDownChoice.
>
>
>
> -----
> david
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/how-to-get-the-listview-s-dropdownchoice-value-tp4654012p4654016.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Re: how to get the listview's dropdownchoice value

Posted by "david.li" <lx...@hotmail.com>.
Through the ddlmodel.getObject() just get the value of the last
DropDownChoice,but I want to get the value of the all DropDownChoice.



-----
david
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-get-the-listview-s-dropdownchoice-value-tp4654012p4654016.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: how to get the listview's dropdownchoice value

Posted by Thomas Götz <to...@decoded.de>.
ddlmodel.getObject()?

   -Tom


On 20.11.2012, at 05:24, david.li <lx...@hotmail.com> wrote:

> the code like this:
> List<String> selection = Arrays.asList("A", "B");
> form.add(new ListView("lis", selection) {
> 
> 	@Override
> 	protected void populateItem(ListItem item) {
> 		List list;
> 		if (item.getModelObject().equals("A")) {
> 			list = Arrays.asList("a1", "a2");
> 		} else {
> 			list = Arrays.asList("b1", "b2");
> 		}
> 		DropDownChoice ddl = new DropDownChoice("ddltest", ddlmodel, list);
> 		item.add(ddl);
> 	}
> 
> });


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