You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by tech7 <te...@gmail.com> on 2011/03/20 19:41:32 UTC
Getting data from dynamically constructed elements
Hi to everyone,
I have a loop and inside this loop; i am constructing checkgroups in the
listview but I dont know how to get data after the user has selected.Do you
have any idea?I need your suggestions.
With my best regards.
-----
Developer
Wicket
Java
JSP
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-data-from-dynamically-constructed-elements-tp3391580p3391580.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: Getting data from dynamically constructed elements
Posted by tech7 <te...@gmail.com>.
Thank you for your response I got it
-----
Wicket-Java
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-data-from-dynamically-constructed-elements-tp3391580p3393708.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: Getting data from dynamically constructed elements
Posted by James Carman <ja...@carmanconsulting.com>.
The state of the checkboxes is determined by the model. So, just make
sure the model doesn't contain those values. Take a look at:
http://wicketstuff.org/wicket14/forminput/
for an example. The model isn't completely obvious (which is why I
dislike CompoundPropertyModels), but the values that will be checked
will be the ones that are contained in the FormInputModel's
"numbersCheckGroup" property (which is an ArrayList<String>). So, if
a Check's model value is contained in the "numbersCheckGroup" list,
then that Check will be selected.
On Mon, Mar 21, 2011 at 8:16 AM, tech7 <te...@gmail.com> wrote:
> I have assigned that groupModels to checkGroup but all checkboxes are coming
> checked.
> How can I display them as unchecked at first display??
>
>
> -----
> Wicket-Java
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-data-from-dynamically-constructed-elements-tp3391580p3393405.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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Getting data from dynamically constructed elements
Posted by tech7 <te...@gmail.com>.
I have assigned that groupModels to checkGroup but all checkboxes are coming
checked.
How can I display them as unchecked at first display??
-----
Wicket-Java
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-data-from-dynamically-constructed-elements-tp3391580p3393405.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: Getting data from dynamically constructed elements
Posted by tech7 <te...@gmail.com>.
Any suggestions?
-----
Wicket-Java
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-data-from-dynamically-constructed-elements-tp3391580p3392901.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: Getting data from dynamically constructed elements
Posted by tech7 <te...@gmail.com>.
Thank you for your response.
I got this error when I tried to run your suggestion:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at xxx.xxx.xxx.xxx.PGMix$8.populateItem(PGMix.java:314)
at org.apache.wicket.markup.html.list.Loop.onPopulate(Loop.java:137)
at
org.apache.wicket.markup.repeater.AbstractRepeater.onBeforeRender(AbstractRepeater.java:131)
at
org.apache.wicket.Component.internalBeforeRender(Component.java:1065)
at org.apache.wicket.Component.beforeRender(Component.java:1099)
at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753)
at org.apache.wicket.Component.onBeforeRender(Component.java:3940)
at
org.apache.wicket.markup.html.form.Form.onBeforeRender(Form.java:2056)
at
org.apache.wicket.Component.internalBeforeRender(Component.java:1065)
at org.apache.wicket.Component.beforeRender(Component.java:1099)
at
org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.java:1753)
Do you have any idea about this?
-----
Wicket-Java
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-data-from-dynamically-constructed-elements-tp3391580p3392169.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: Getting data from dynamically constructed elements
Posted by Martin Grigorov <mg...@apache.org>.
in your case:
propertyLoop1.get(someIterationAsString).get("groyp").getModelObject()
but better pass a List to the itemsGroup which is reachable without using
the tree as above
e.g.
List<List> groupModels = ...;
and then:
final CheckGroup itemsGroup = new CheckGroup("group",
groupModels.get(propertyItem.getIteration()));
On Sun, Mar 20, 2011 at 10:10 PM, tech7 <te...@gmail.com> wrote:
> My code is like that:
>
> propertyLoop1 = new Loop("properties1", propertyList1.size()) {
>
> @Override
> protected void populateItem(final LoopItem
> propertyItem) {
> final Property property1 =
> propertyList1.get(propertyItem.getIteration());
> propertyItem.add(new Label("propertyName1",
> property1.getName()));
>
> final List itemList1 = new
> ArrayList(property1.getItems());
>
> final CheckGroup itemsGroup = new
> CheckGroup("group", new ArrayList());
>
> ListView items = new ListView("items",
> itemList1) {
>
> protected void populateItem(ListItem
> itemItem) {
> Check check = new
> Check("itemCheck", itemItem.getModel());
> Label label = new
> Label("itemName", new
> PropertyModel(itemItem.getModel(), "name"));
> itemItem.add(check);
> itemItem.add(label);
> };
>
> };
> items.setReuseItems(true);
> itemsGroup.add(items);
> propertyItem.add(itemsGroup);
> };
> };
>
> I am really stuck on this.
>
> -----
> Developer
> Wicket
> Java
> JSP
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Getting-data-from-dynamically-constructed-elements-tp3391580p3391999.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: Getting data from dynamically constructed elements
Posted by tech7 <te...@gmail.com>.
My code is like that:
propertyLoop1 = new Loop("properties1", propertyList1.size()) {
@Override
protected void populateItem(final LoopItem propertyItem) {
final Property property1 =
propertyList1.get(propertyItem.getIteration());
propertyItem.add(new Label("propertyName1", property1.getName()));
final List itemList1 = new ArrayList(property1.getItems());
final CheckGroup itemsGroup = new CheckGroup("group", new ArrayList());
ListView items = new ListView("items", itemList1) {
protected void populateItem(ListItem itemItem) {
Check check = new Check("itemCheck", itemItem.getModel());
Label label = new Label("itemName", new
PropertyModel(itemItem.getModel(), "name"));
itemItem.add(check);
itemItem.add(label);
};
};
items.setReuseItems(true);
itemsGroup.add(items);
propertyItem.add(itemsGroup);
};
};
I am really stuck on this.
-----
Developer
Wicket
Java
JSP
--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Getting-data-from-dynamically-constructed-elements-tp3391580p3391999.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: Getting data from dynamically constructed elements
Posted by James Carman <ja...@carmanconsulting.com>.
What model is your checkgroup bound to?
On Mar 20, 2011 2:41 PM, "tech7" <te...@gmail.com> wrote:
> Hi to everyone,
> I have a loop and inside this loop; i am constructing checkgroups in the
> listview but I dont know how to get data after the user has selected.Do
you
> have any idea?I need your suggestions.
> With my best regards.
>
> -----
> Developer
> Wicket
> Java
> JSP
> --
> View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Getting-data-from-dynamically-constructed-elements-tp3391580p3391580.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
>