Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I nest dynamic tables in wicket?
    text
    copied!<p>I'm using wicket to display a list of tables. The number of tables, and the number of rows in each table, are both dynamic.</p> <p>I'm trying to keep it simple and use a RepeatingView for each, and nest them, but wicket says:</p> <blockquote> <p>java.lang.IllegalArgumentException: A child with id 'table' already exists</p> </blockquote> <p>Here is my Java:</p> <pre><code> RepeatingView view = new RepeatingView("listoftables"); for (CCSubscription sub: getCustomer().getSubscriptions()) { //resource balance table ResourceBalance[] resBals = sub.getResourceBalances(); if(resBals!=null &amp;&amp; resBals.length&gt;0) { ListView&lt;ResourceBalance&gt; resBalTable = new ListView&lt;ResourceBalance&gt;("table", Arrays.asList(resBals)) { @Override protected void populateItem(ListItem&lt;ResourceBalance&gt; item) { ResourceBalance bal = item.getModelObject(); item.add(new Label("resource", bal.getResource().getName())); item.add(new Label("balance", bal.getBalance())); } }; view.add(resBalTable); } //end if sub has non-null resource balance } //end loop through subscriptions add(view); </code></pre> <p>And my html is :</p> <pre><code>&lt;ul&gt; &lt;li wicket:id="listoftables"&gt; &lt;fieldset&gt; &lt;legend&gt;&lt;b&gt;Resource Balances&lt;/b&gt; &lt;/legend&gt; &lt;table class="dataview" style="width:50%"&gt; &lt;thead&gt; &lt;tr class="headers"&gt; &lt;th&gt;Resource&lt;/th&gt; &lt;th&gt;Balance&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tr wicket:id="table"&gt; &lt;td&gt; &lt;span wicket:id="resource"&gt;&lt;/span&gt; &lt;/td&gt; &lt;td&gt; &lt;span wicket:id="balance"&gt;&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/fieldset&gt; &lt;br/&gt; </code></pre> <p></li> </p> <p>I concede that I'm probably going about this the wrong way, but I can't see what the right way should be.</p> <p>Hope someone can help!?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload