0.概述
Home Page:http://www.extremecomponents.org
Extreme Table是最功能强大而又Ҏ配置,扩展,自定义的Table 控g?/p>
最紧要的功能包括排? 分页, 导出Excel, pdf和汇怅R?/p>
springside的best CZ代码? listBook.jsp和listOrder.jsp.
基础ȝ:
1. ?a >http://www.extremecomponents.org 下蝲最新版
2.把extremecomponents.jar 攑օweb-inf/lib
3.Ҏminum, 导出excel ?导出pdf的需要,?lib下的jar copy到web-inf/lib
4.把images里的囄攑օweb的Q意目?/p>
5.把css文g攑ֈweb的Q意目?/p>
6.?source/org/extremecomponents/table/core目录扑ֈextremetable.properties文g,把它复制到WEB-INF/classes里面q进行修?
7.修改web.xml (?)?/p>
1.Copy springside的Table Head的图Q查?/p>
2.springside中的修改版extremecomponents.css文g攑օL目录
3.?src/resource/extremetable.properties 复制到对应目?/p>
默认的式样不W合大家的审,q怺q有Compact View和css讄Q让我们可以敬谢不敏它号U非常方便的HtmlView子类扩展?/p>
1. 在全局讄?/p>
table.view.html=org.extremecomponents.table.view.CompactView
2.把images?table/compact/*.gif copy ?/table
ExtremeTable支持在properties文g里方便的l一配置丰富的全局属?/p>
?source/org/extremecomponents/table/core目录扑ֈextremetable.properties文g,把它复制到WEB-INF/classes里面.
在web.xml里面增加
<context-param>
<param-name>extremecomponentsPreferencesLocation</param-name>
<param-value>/extremetable.properties</param-value>
</context-param>
一般只写需要修改的文g:
table.filterable=false
table.imagePath=/images/table/*.gif
table.locale=zh_CN
table.view.html=org.extremecomponents.table.view.CompactView
row.highlightRow=true
column.format.date=yyyy-MM-dd
column.format.currency=###,###,###,###,#00.00
注意Excel 导出的Tag已改为,且官方版不支持中文文件名?/p>
<ec:exportXls fileName="BookList.xls" tooltip="导出 Excel"/>
在web.xml必须加入Q?/p>
<filter>
<filter-name>eXtremeExport</filter-name>
<filter-class>org.extremecomponents.table.filter.ExportFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>eXtremeExport</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
ExtremeTable导出的一w要特性是可以Ҏ不同的View导出不同的列.
比如html理界面可能只列单几个最重要的列Q而导出excel时则需要导出所有的列?/p>
<ec:column property="orderdate" title="订单日期" cell="date" format="yyyy-MM-dd" viewsDenied= "html"/>
又比如有些操作按U的列只惛_html出现,excel里不惛_玎ͼ
<ec:column property="orderdate" title="订单日期" viewAllowed= "html"/>
以上订单日期列在html view看不刎ͼ而excel,pdf view可以见到.
?~辑图标"Q?选择Checkbox"q些理界面上的列,也可以设|不export到pdf,excel view
因ؓjavascript的关p?
<ec:column property="customer.name" title="客户名称" alias="customer"/>
在全局属性定?
column.format.date= yyyy-MM-dd column.format.currency= K?##,###,#00.00
<ec:column property="totalprice" title="总金? cell="currency" width="80" />
<ec:column property="shipdate" title="发货日期" cell="date" width= "80"/>
<e
其中RowCountCell用于昄序号?/p>
在column中加入两个cac属性,׃自动在table的底端显C汇?/p>
<ec:column property="totalprice" title="总金? cell="number" format="###,###,##0.00" calc="total" calcTitle= "汇?"/>
在Web.xml里面指定i18N的Properties文g
<context-param>
<param-name>extremecomponentsMessagesLocation</param-name>
<param-value>messages</param-value>
</context-param>
<ec:column property="name" title="book.name"/>
EC默认从数据库中查找所有记录然后由它来分页Q如果查询结果较大,可以考虑使用数据库端分页的方案?/p>
此时QEC会用Limit对象向Controller传递PageNo,PageSize,OrderBy{分信息。而服务端向ECq回总记录数和当前页的内容,具体请参?BookController?/p>
最快的方式是设|table的showStatusBar= false
<ec:table items= "order.orderItems"var="item" action="" showStatusBar= "false">
旧版EC包括其文都在每个table tag里定义ImagePath, 新版已经可以自动插入ContextPath,只需在properties文g定义table.imagePath=/images/table/*.gif卛_
ExtremeTable比Display Tag的i一个就是良好的自定义和扩展能力Q不用千Z面?br /> 不过QhL懒的Q虽然扩展子cdҎQ但能不扩展p是不可扩展了。幸亏用Compact View再改改CSS一般就能达到要求?/p>
ExtremeTable 的CSS定义非常严}, q且提供很多个层ơ的修改方式:
1.直接修改css文g, 可以把table viewҎL样式
2.修改全局属? 改变某种元素对应的css class?/p>
table.styleClass=tableRegion
3.在某个页面的row,column tag中定义class
<ec:row style="" or styleClass=""/>
SpringSide采用层次1, 直接修改extremecomponents.css为合适的样式
row与column已提供了丰富的普通属性与 javascript属性如onClick(), 如果属性仍然未?可自行扩?lt;row>?lt;column>tag Qƈ通过全局属性指定新的子cd?/p>
Z方便大家在子cL展属? extreme Table提供了专门的回调函数与Util函数?/p>
public void addColumnAttributes(Column column) { column.addAttribute("customAttributeOne", customAttributeOne);
}
详细L手册,Table, Row,Column都提供相同的扩展:
http://extremecomponents.org/wiki/index.php/Column#Extended_Attributes
如果不是Extremetable的特别支? 普通taglib class要扩展属性的?
1.定义真正的Java属?setter,getter
2. tld文g中声明新的属?
3.重蝲输出函数新属性打印出?/p>
Extreme Table在这些类的扩展上放便很多Q但q个版本里我q没有进行尝试,׃写了。请自行参考官Ҏ?http://extremecomponents.org/wiki/index.php/Html_View_Tutorial .
http://www.springside.org.cn/docs/reference/ExtremeTable.htm