我在渲染表格的标题时遇到了问题。它没有在表格上显示任何颜色。我将 HeadersToolbar 与我的数据一起使用,如下所示。
import org.apache.wicket.Component;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.HeadersToolbar;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider;
import org.apache.wicket.extensions.markup.html.repeater.data.table.NavigationToolbar;
import org.apache.wicket.markup.html.internal.HtmlHeaderContainer;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.OddEvenItem;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
public class CustomTable extends DataTable {
private static final long serialVersionUID = 5912216230302446976L;
public CustomTable(String id, List columns,
ISortableDataProvider dataProvider, int rowsPerPage) {
this(id, (IColumn[]) columns.toArray(new IColumn[columns.size()]),
dataProvider, rowsPerPage);
}
public CustomTable(String id, IColumn[] columns,
ISortableDataProvider dataProvider, int rowsPerPage) {
super(id, columns, dataProvider, rowsPerPage);
// super(id, columns, dataProvider, rowsPerPage);
addTopToolbar(new NavigationToolbar(this));
addTopToolbar(new HeadersToolbar(this, dataProvider));
}
protected Item newRowItem(String id, int index, IModel model) {
return new OddEvenItem(id, index, model);
}
}
我详细看到了 HeaderToolbar 它将生成 CSS 类“标题”。然后我在 View Source 中看到。我有名为“headers”的css类。
如何自定义 HeaderToolbar 以获得正确的表格行标题显示颜色或者我可以创建新的 Css 类吗?
任何人都可以帮我解决这个问题吗?:)