Hi Janos,
I did what you advised me to do but got the following exception (in this
case I used a list of 3 entries with 3 fields):
Unexpected RuntimeException

WicketMessage: The component(s) below failed to render. A common problem is
that you have added a component in code but forgot to reference it in the
markup (thus the component will never be rendered).

1. [MarkupContainer [Component id = cell]]
2. [Component id = 1]
3. [Component id = 2]
4. [Component id = 3]
5. [Component id = 4]
6. [MarkupContainer [Component id = cell]]
7. [Component id = 1]
8. [Component id = 2]
9. [Component id = 3]
10. [Component id = 4]

Root cause:

org.apache.wicket.WicketRuntimeException: The component(s) below failed to
render. A common problem is that you have added a component in code but
forgot to reference it in the markup (thus the component will never be
rendered).

1. [MarkupContainer [Component id = cell]]
2. [Component id = 1]
3. [Component id = 2]
4. [Component id = 3]
5. [Component id = 4]
6. [MarkupContainer [Component id = cell]]
7. [Component id = 1]
8. [Component id = 2]
9. [Component id = 3]
10. [Component id = 4]

at org.apache.wicket.Page.checkRendering(Page.java:1121)
at org.apache.wicket.Page.renderPage(Page.java:914)
at
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:249)
at
org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104)
at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1194)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1265)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1366)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:498)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:444)
at
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

//* File listings
//*****************************************************************
//EntryListPage.html

<html xmlns:wicket>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>EntryListPage</title>
        <link rel="stylesheet" type="text/css" href="style.css"/>
    </head>
    <body>
        
    </body>
</html>
//******************************************************************
// EntryListPage.java

public final class EntryListPage extends WebPage {
    public EntryListPage() {
        super ();

        ArrayList<EntryData> entries = createSampleEntries();
        EntryDataPanel entryDataPanel = new EntryDataPanel("entryDataPanel",
entries);
        add(entryDataPanel);
        [...]
    }
}
//******************************************************************
// EntryDataPanel.html
<html xmlns:wicket>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>EntryDataPanel</title>
    </head>
    <body>
        <wicket:panel>
            <table border="1">
            <tr>
              <th>Entry Id</th>
              <th wicket:id="heading">
              </th>
            </tr>
            <tr wicket:id="row">
              <td wikcet:id="cell">
              </td>
            </tr>
            </table>
        </wicket:panel>
    </body>
</html>

//******************************************************************
// EntryDataPanel.java
public final class EntryDataPanel extends Panel
{
    public EntryDataPanel(String id, ArrayList<EntryData> entries)
    {
        super (id);

        RepeatingView heading = new RepeatingView("heading");
        for (FieldData fd : entries.get(0).entryFields)
        {
            heading.add(new Label(heading.newChildId(), fd.fieldLabel));
        }
        add(heading);
        RepeatingView row = new RepeatingView("row");
        add(row);
        for (EntryData ed : entries)
        {
           WebMarkupContainer r = new WebMarkupContainer(row.newChildId());
           RepeatingView cell = new RepeatingView("cell");
           row.add(r);
           r.add(cell);
           cell.add(new Label(cell.newChildId(), ed.entryID));
           for (FieldData fd : ed.entryFields)
           {
                cell.add(new Label(cell.newChildId(), fd.fieldValue));
           }
        }
    }
}

I don't really know which component I am missing in the markup.
I would be very grateful if you could help me once again, please.
Regards
R





Janos Cserep-2 wrote:
> 
> 
> I would use a custom panel component which would have the following
> markup:
> <tr>
>    <th>Entry Id</th>
>   <th wicket:id="heading">
>   </th>
> </tr>
> <tr wicket:id="row">
>   <td wikcet:id="cell>
>   </td>
> </tr>
> 
> And the code:
> 
> RepeatingView heading = new RepeatingView("heading");
> for (FieldData fd : entries.get(0).entryFields) {
>   heading.add(new Label(heading.newChildId(), fd.fieldLabel));
> }
> add(heading);
> RepeatingView row = new RepeatingView("row");
> add(row);
> for (EntyData ed : entries) {
>    WebMarkupContainer r = new WebMarkupContainer(row.newChildId());
>    RepeatingView cell = new RepeatingView('cell");
>    row.add(r);
>    r.add(cell);
>    cell.add(new Label(cell.newChildId(), ed.entryId));
>    for (FieldData fd : ed.entryFields) {
>      cell.add(new Label(cell.newChildId(), fd.fieldValue));
>    }
> }
> 
> You need the WebMarkupContainer because it will get the same markup that
> the
> "row" repeatingview gets.
> 
> This is quite basic, there is some room for optimization but I hope you
> get
> it.
> 
> Janos
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Repeater-component-with-dynamic-column-list-tp22700806p22709785.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to