You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by robinthapa <li...@gmail.com> on 2011/11/20 11:20:12 UTC

PageableListView Not Rendering Data as required

 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?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageableListView-Not-Rendering-Data-as-required-tp4088337p4088337.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: PageableListView Not Rendering Data as required

Posted by jcgarciam <jc...@gmail.com>.
You have to  build the SQL query in a away it returns the data in the way
you one. After that it will easier to map the ListView.

Based on your example want to represent certain rows as columns values.




On Sun, Nov 20, 2011 at 7:20 AM, robinthapa [via Apache Wicket] <
ml-node+s1842946n4088337h88@n4.nabble.com> wrote:

>  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?
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-wicket.1842946.n4.nabble.com/PageableListView-Not-Rendering-Data-as-required-tp4088337p4088337.html
>  To unsubscribe from Apache Wicket, click here<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1842946&code=amNnYXJjaWFtQGdtYWlsLmNvbXwxODQyOTQ2fDEyNTYxMzc3ODY=>
> .
> NAML<http://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 

JC


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/PageableListView-Not-Rendering-Data-as-required-tp4088337p4088685.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