title: Extension of Wicket DataTable
body: <p>Can we extend a <code>DataTable</code> in another <code>DataTable</code>?</p>
  
  <p>My scenario is I would like to build a <code>DataTable</code> called <code>BaseTable</code> which contains three columns: <code>id</code>, <code>name</code>, <code>color</code>. I want to build another two tables called <code>Table1</code> which extends <code>BaseTable</code> and has another column: <code>size</code>; and <code>Table2</code> which also extends <code>BaseTable</code> and has another checkbox column. </p>
  
  <p>Is it possible to do something like this? If possible, can you give me some example or guidelines?</p>
  
  <p><strong>Update</strong></p>
  
  <p>Thank you for your help! It seems to be the answer I want but I did exactly what you said but I ended up get this error:</p>
  
  <pre><code>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 = dt_basecontract_list]]
  2. [MarkupContainer [Component id = body]]
  3. [MarkupContainer [Component id = rows]]
  4. [MarkupContainer [Component id = 1]]
  5. [MarkupContainer [Component id = cells]]
  6. [MarkupContainer [Component id = 1]]
  7. [Component id = cell]
  8. [MarkupContainer [Component id = 2]]
  9. [Component id = cell]
  10. [MarkupContainer [Component id = 3]]
  11. [MarkupContainer [Component id = cell]]
  12. [MarkupContainer [Component id = detail]]
  13. [MarkupContainer [Component id = delete]]
  </code></pre>
  
  <p>In case you need there information..</p>
  
  <p>Base Class : ContractBasePanel</p>
  
  <pre><code>// A Base Contract DataTable Panel
  public class ContractBasePanel extends Panel  {
  
      // Inject the ApplicationFacade
      @EJB(name="applicationFacade")
      private ApplicationFacadeLocal applicationFacade;
  
      public ContractBasePanel(String id, ApplicationFacadeLocal applicationFacade) {
          super(id);
          add(new DefaultDataTable&lt;Contract&gt;("dt_basecontract_list", getColumns(), new ContractProvider(applicationFacade), 10));
      }
  
      protected List&lt;IColumn&lt;Contract&gt;&gt; getColumns(){
          List&lt;IColumn&lt;Contract&gt;&gt; columns = new ArrayList&lt;IColumn&lt;Contract&gt;&gt;();
          columns.add(new PropertyColumn&lt;Contract&gt;(new Model&lt;String&gt;("ContractIdentifier"), "contractIdentifier"));
          columns.add(new PropertyColumn&lt;Contract&gt;(new Model&lt;String&gt;("Assigned To"), "customer.name"));
          return columns;
      }
  }
  
  Inherited Class : ContractModelRootPanel
  
  // A Panel which displays a DataTable of contract
  public class ContractModelRootPanel extends ContractBasePanel  {
  
      // Inject the ApplicationFacade
      @EJB(name="applicationFacade")
      private ApplicationFacadeLocal applicationFacade;
  
      // Represent the Contract Object selected by clicking "detail" or "delete" link
      private Contract contractSelected;
  
      public ContractModelRootPanel(String id, ApplicationFacadeLocal applicationFacade) {
          super(id, applicationFacade);
          add(new DefaultDataTable&lt;Contract&gt;("dt_contract_list", getColumns(), new ContractProvider(applicationFacade), 10));
      }
  
      class ActionPanel extends Panel
      {
          public ActionPanel(String id, IModel&lt;Contract&gt; model)
          {
              super(id, model);
              add(new Link("detail")
              {
                  @Override
                  public void onClick()
                  {
                      // get Contract object which contains only contract identifier
                      contractSelected = (Contract)getParent().getDefaultModelObject();
                      PageParameters pageParameters = new PageParameters();
                      pageParameters.add("contractIdentifier", contractSelected.getContractIdentifier());
  
                      // handle the displays message if the contract has no owner
                      if(contractSelected.getCustomer() != null)  {
                          pageParameters.add("customerName", contractSelected.getCustomer().getName());
                      }
                      else  {
                          pageParameters.add("customerName", "-Not Bound to Any Customer-");
                      }
                      setResponsePage(ContractDetail.class, pageParameters);
                  }
              });
  
              add(new Link("delete")
              {
                  @Override
                  public void onClick()
                  {
                      // get Contract object which contains only contract identifier
                      contractSelected = (Contract)getParent().getDefaultModelObject();
                      applicationFacade.deleteContract(contractSelected.getContractIdentifier());
                      RequestCycle rc = RequestCycle.get();
                      rc.setResponsePage(HomePage.class);
                  }
              });
          }
      }
  
      @Override
      protected List&lt;IColumn&lt;Contract&gt;&gt; getColumns() {
          List&lt;IColumn&lt;Contract&gt;&gt; columns = super.getColumns();
          // column for "detail" and "delete" link
          columns.add(new AbstractColumn&lt;Contract&gt;(new Model&lt;String&gt;("Edits"))
                  {
                      public void populateItem(Item&lt;ICellPopulator&lt;Contract&gt;&gt; cellItem, String componentId,
                          IModel&lt;Contract&gt; model)
                      {
                          cellItem.add(new ActionPanel(componentId, model));
                      }
                  });
          return columns;
      }
  }
  </code></pre>
  
  <p>HTML of both classes are the same except the wicket id which is <code>dt_basecontract_list</code> and <code>dt_contract_list</code>.</p>
  
  <p>Where does this error come from?</p>