wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From extraquoo <extraq...@gmail.com>
Subject how to get parent listView item index in the child listview populateItem method
Date Wed, 02 Aug 2017 21:38:10 GMT
Hi , I try to use setOutputMarkupId and setMarkupId to generate the id for
the component radio button 

the hierarchy is 

List<IncomeDetail> incomeDetail has a child List<IncomeA> incomeA.

 I use PropertyListView to loop List incomeDetail and in populateItem method

I use another PropertyListView to loop List IncomeA, then in the child
PropertyListView, I want to get the current index of parent list
incomeDetail to construnct an id for the radio button object in IncomeA.

code is like below

final PropertyModel<List&lt;IncomeDetail>> currentIncomeList = new
PropertyModel<List&lt;IncomeDetail>>(sectionThreeModel, "incomes");

final PropertyListView<IncomeDetail> incomeExpenseDetail = new
PropertyListView<IncomeDetail>("section3.currentIncome", currentIncomeList,
IncomeDetail.class){
					
				private static final long serialVersionUID = 1L;
				int a =1;
					
				@Override
				protected void populateItem(ListItem<IncomeDetail> item) {
					IncomeDetail incomeDetail = (IncomeDetail) item.getModelObject();
final PropertyModel<List&lt;IncomeA>> populateIncomeList = new
PropertyModel<List&lt;IncomeA>>(item.getDefaultModelObject(),
"incomeEstimate");

final PropertyListView<IncomeA> incomeListView = new
PropertyListView<IncomeA>("section3.incomes.populateIncomeDetail", 
							populateIncomeList ,IncomeA.class){

					
							private static final long serialVersionUID = 1L;

							
							@Override
							protected void populateItem(ListItem<IncomeA> item ) {
IncomeA income = (IncomeA) item.getModelObject();
......
yesRadio.setOutputMarkupId(true).setMarkupId("corectRadio_Y_"+* i * );
.........

here *i *should be the parent listview current index.




--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-get-parent-listView-item-index-in-the-child-listview-populateItem-method-tp4678401.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


Mime
View raw message