分页不适用于ehour 1.2

时间:2013-05-03 07:35:02

标签: wicket

当我点击下一页时,分页在ehour1.2中不起作用。这是链接

http://www.ehour.nl/forum/viewtopic.php?f=2&t=40529#p41972

 Pagination is not working in ehour1.2 when i click on next page. Here is the link

http://www.ehour.nl/forum/viewtopic.php?f=2&t=40529#p41972

这是我的java代码:

public class TreeReportDataPanel extends Panel {
private static final long serialVersionUID = -6757047600645464803L;
private static final AttributeModifier CSS_ALIGN_RIGHT =   AttributeModifier.replace("style", "text-align: right;");

private final ReportConfig reportConfig;

public TreeReportDataPanel(String id,
                           TreeReportModel reportModel,
                           ReportConfig reportConfig,
                           final ExcelReport excelReport
) {
    super(id);

    this.reportConfig = reportConfig;

    Border blueBorder = new BlueTabRoundedBorder("blueFrame");
    add(blueBorder);
    blueBorder.setOutputMarkupId(true);

    if (excelReport != null) {
        blueBorder.add(new ExcelLink("excelLink", reportModel.getReportCriteria()) {
            @Override
            protected ExcelReport createReportBuilder() {
                return excelReport;
            }
        });
    } else {
        blueBorder.add(HtmlUtil.getInvisibleLink("excelLink"));
    }

    blueBorder.add(getReportHeaderLabel("reportHeader", reportModel.getReportRange(), EhourWebSession.getSession().getEhourConfig()));
    addHeaderColumns(blueBorder);
    addReportData(reportModel, blueBorder);
    addGrandTotal(reportModel, blueBorder);
}



  @SuppressWarnings("unchecked")
private void addReportData(TreeReportModel reportModel, WebMarkupContainer parent) {
    List<TreeReportElement> elements = (List<TreeReportElement>) reportModel.getReportData().getReportElements();

    DataView<TreeReportElement> dataView = new TreeReportDataView("reportData", new TreeReportDataProvider(elements));
    dataView.setOutputMarkupId(true);
    dataView.setItemsPerPage(20);

    parent.add(new HoverPagingNavigator("navigator", dataView));
    parent.add(dataView);
}

public class HoverPagingNavigator extends AjaxPagingNavigator {
private static final long serialVersionUID = 1095553728045877576L;
private final IPageable pageable;

public HoverPagingNavigator(String id, IPageable pageable) {
    super(id, pageable);
    this.pageable = pageable;
}

@Override
public boolean isVisible() {
    return pageable.getPageCount() > 1;
}

}

我的HTML看起来像这样:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

                                                            

            <div style="width:100%;text-align: right;height:22px"><a wicket:id="excelLink"
                                                                     title="Export to Excel"><img src="img/download.png" border="0"/></a></div>

            <table class="reportTable" cellpadding="0" cellspacing="0">
                <thead>
                <tr>
                    <th wicket:id="columnHeaders"></th>
                </tr>
                </thead>

                <tfoot>
                <tr class="totalRow">
                    <td wicket:id="cell" valign="top"><b>2,140</b></td>
                </tr>
                </tfoot>

                <tbody>
                <tr class="dataRow" wicket:id="reportData">
                    <td wicket:id="cell" valign="top"></td>
                </tr>
                </tbody>

            </table>

            <span wicket:id="navigator">[dataview navigator]</span>

        </div>
    </div>
</div>

i think blueFrame_body is the generated one, i can't set the setOutputMarkupId property set to true. I always get the following error message:

Caused by: java.lang.IllegalArgumentException: cannot update component that does not have setOutputMarkupId property set to true. Component: [BorderBodyContainer [Component id = blueFrame_body]]

1 个答案:

答案 0 :(得分:2)

从您的筹码堆:cannot update component that does not have setOutputMarkupId property set to true - &gt; Component: blueFrame_body。很难说这是否是唯一的原因,但试试这个:

blueFrame_body.setOutputMarkupId(true);