PageableListView Not rendering my data as required
Posted
by
Robin
on Stack Overflow
See other posts from Stack Overflow
or by Robin
Published on 2011-11-20T09:44:42Z
Indexed on
2011/11/20
9:53 UTC
Read the original article
Hit count: 224
i am working on wicket, where i am supposed to show my data's under
<tr>
<td>Name</td>
<td>Single Player Score</td>
<td>Double Player Score</td>
<td>Total Score</td>
</tr>
<tr wicket:id="data">
<td wicket:id="name"></td>
<td wicket:id="singlePlayerScore"></td>
<td wicket:id="doublePlayerScore"></td>
<td wicket:id="totalScore"></td>
</tr>
My Player model class is as: Player class with attributes singlePlayerScore, doublePlayerScore(), name with getter and setter and also a list data obtained from database.
Data from SQLQuery is as;
name score gamemode
A 200 singlePlayerMode
A 100 doublePLayerMode
B 400 singlePlayerMode
B 300 doublePLayerMode
dataList == player.getScoreList();
My PageableListView is as:
final PageableListView listView = new PageableListView("data",dataList,10){
@Override
protected void populateItem(Item item){
player = (Player)item.getModelObject();
item.add(Label("name",player.getName()));
item.add(Label("singlePlayerScore",player.getName()));
item.add(Label("doublePlayerScore",player.getName()));
item.add(Label("totalScore",String.valueOf(player.getSinglePlayerScore()+player.getDoublePlayerScore())));
}
}
My Problem is as: What view i get is as:
Name single Player Score Double Player Score Total Score
A 0 100 100
A 200 0 200
B 0 300 300
B 400 0 400
How do i achieve below view on my webpage?
Name single Player Score Double Player Score Total Score
A 200 100 300
B 400 300 700
Please help me as to why is this happening? I guess my list has size four that's one reason why as to it is rendering the view? So what can i do to get as require rendering view?
© Stack Overflow or respective owner