2012-08-15 82 views
0

我正在使用檢票1.5.7,我想在DefaultDataTable的單元格中創建一個鏈接。
所以我複製this page中的示例,但我得到檢票運行時錯誤:在檢票口中使整行可點擊

最後一個原因:無法找到關聯的標記文件。 ActionPanel:[ActionPanel [組件id =電池]

這裏是我的一些代碼:

public GroupsList(final PageParameters parameters) 
{ 
    ArrayList<IColumn> columns = new ArrayList<IColumn>(); 
    columns.add(new AbstractColumn<Group>(new Model<String>("Actions")) 
    { 
     public void populateItem(Item<ICellPopulator<Group>> cellItem, String componentId, 
      IModel<Group> model) 
     { 
      cellItem.add(new ActionPanel(componentId, model)); 
     } 
    }); 
    add(new DefaultDataTable("table", columns, new GroupDataProvider(), 8)); 
} 

,這裏是我的ActionPanel

class ActionPanel extends Panel 
{ 
    public ActionPanel(String id, IModel<Group> model) 
    { 
     super(id, model); 
     add(new Link("select") 
     { 
      @Override 
      public void onClick() 
      { 
       PageParameters pp = new PageParameters(); 
       setResponsePage(new HomePage(pp)); 
      } 
     }); 
    } 
} 

任何想法的根本原因?

回答

1

從錯誤消息判斷您錯過了您的ActionPanel.html。要麼它是錯誤的,錯位或完全丟失。面板去,他們需要他們的標記。在提到的例子中,由於ActionPanel是BasePage的內部類,所以標記文件被「隱藏」爲BasePage$ActionPanel.html