You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by eugenebalt <eu...@yahoo.com> on 2013/09/13 15:03:36 UTC

Pre-Selecting Dropdown from Shared Panel serving 2 Model Databeans

We have a shared Panel containing a dropdown.

The Panel is used on 2 different pages where each page has its own model as
an associated bean POJO class. My problem is that I have to pre-select the
dropdown in the panel to a certain index.

Normally, this is done by setting a Model value. I can't do that here
because I don't store the beans and I don't do setModel(..) on them.

This doesn't work either, because the form hasn't been submitted yet and
getModelObject() is NULL:

		Object modelObject = ((Form)(this.getParent())).getModelObject();
		if (modelObject.getClass().getName().endsWith("Bean_A"))
			((Bean_A)modelObject).setVerPeriod(optionsVerPeriod.get(vPeriodIndex));
		else
			((Bean_B)modelObject).setVerPeriod(optionsVerPeriod.get(vPeriodIndex));

Any ideas? Thanks



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Pre-Selecting-Dropdown-from-Shared-Panel-serving-2-Model-Databeans-tp4661306.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: Pre-Selecting Dropdown from Shared Panel serving 2 Model Databeans

Posted by eugenebalt <eu...@yahoo.com>.
I found a solution, I'm passing the model Data Bean as a parameter to the
Panel in the constructor. Then I have access to it.



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Pre-Selecting-Dropdown-from-Shared-Panel-serving-2-Model-Databeans-tp4661306p4661307.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