Home > Web Front-end > HTML Tutorial > 调整wicket DataTable的表格输出html_html/css_WEB-ITnose

调整wicket DataTable的表格输出html_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:18:57
Original
1232 people have browsed it

方法1:

继承DefaultDataTable,并且提供自己的html模板。

方法2:

继承DefaultDataTable,在构造函数中添加AttributeModifier,这样不用提供html模板,模板自动继承自DefaultDataTable.html

关于Odd,Even。也就是表格提供斑马效果,可以复写DefaultDataTable的newRowItem方法:

@Override	protected Item<T> newRowItem(final String id, final int index, final IModel<T> model)	{		return new OddEvenItem<T>(id, index, model);	}		//OddEvenItem的内容:		@Override	protected void onComponentTag(ComponentTag tag)	{		super.onComponentTag(tag);		tag.put("class", (getIndex() % 2 == 0) ? CLASS_EVEN : CLASS_ODD);	}
Copy after login

可以新建一个类继承自OddEvenItem,复写onComponentTag,比如对于purecss的table来说:

@Override	protected void onComponentTag(ComponentTag tag)	{		super.onComponentTag(tag);		if (getIndex() % 2 != 0) {            	    tag.put("class", "pure-table-odd");		}			}
Copy after login


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template