杞嚜錛歨ttp://mhbjava.javaeye.com/blog/26591
1.
<ec:table
items="presidents"
var="pres"
imagePath="${pageContext.request.contextPath}/images/*.gif"
action="${pageContext.request.contextPath}/presidents.run"
filterable="false"
sortable="false" >
...
</ec:table>
<ec:table>閲岀殑灞炴ц繕鏈?
a. rowsDisplayed,rowsDisplayed涔熷彲浠ュ湪extremecomponents.properties鏂囦歡涓瀹?br />
b. showPagination ,濡傛灉浣犳兂鍦ㄤ竴欏典腑鏄劇ず鎵鏈夎錛屽彧闇瑕佽緗畇howPagination涓篺alse銆?br />
c. TableTag鍏寵仈浜嗗緢澶氭牱寮忓睘鎬э細
<ec:table cellspacing="0" cellpadding="0" border="0" width="80%" styleClass="" />
鎵鏈夎繖浜涢兘鏄彲閫夌殑銆?/p>
2.
浣跨敤highlightRow灞炴у彲浠ヨ緗鐨勯珮浜樉紺猴紝瀹冪殑鍊間負true鎴杅alse錛岄粯璁ゅ間負false銆?/p>
<ec:table items="presidents" var="pres" action="${pageContext.request.contextPath}/presidents.run" >
<ec:row highlightRow="true">
<ec:column property="name"/>
<ec:column property="term"/>
</ec:row>
</ec:table>
璁劇疆highlightRow灞炴у悗錛屽畠灝嗘彃鍏ヨ緗css綾葷殑javascript鑴氭湰錛岄粯璁ょ殑css 綾諱負highlight銆備綘鍙互浣跨敤highlightClass鏉ヤ嬌鐢ㄥ畾鍒剁殑css綾匯?/p>
3.
涓轟簡渚夸簬浣犲浜庤鏁版嵁榪涜鍔ㄦ佷氦浜掑鐞嗭紝鎻愪緵浜唎nclick銆乷nmouseover鍜?onmouseout灞炴с?/p>
<ec:row onclick="" onmouseover="" onmouseout="" />
4.
RowTag鍏寵仈浜嗗緢澶氭牱寮忓睘鎬э細
<ec:row styleClass="" highlightClass="" />
5.
鎻愪緵鍙夊彇鍊兼柟娉曠殑涓昏鍘熷洜鏄嬌浣犺兘澶熷鍏朵粬綾誨瀷鐨刪tml鏍囩鎻愪緵鍔ㄤ綔鏀寔錛屼緥濡傛樉紺?涓騫呭浘鐗囨垨鑰呴氳繃瀹氫箟href浣胯鍒楁垚涓哄埌鍏跺畠欏電殑涓涓摼鎺ャ?/p>
<ec:table items="presidents" var="pres" action="${pageContext.request.contextPath}/presidents.run" >
<ec:row>
<ec:column property="lastName">
<a href=">
</ec:column>
</ec:row>
</ec:table>
6銆?br />
<ec:column property="time" title="鏃墮棿" parse="yyyy-MM-dd" format="yyyy騫碝M鏈坉d鏃? cell="date"/>
7銆?br />
TableTag
涓湁filterable鍜宻ortable灞炴э紝ColumnTag涓篃鏈夌浉鍚岀殑灞炴с?
鍒楃殑filterable鍜宻ortable灞炴у皢瑕嗙洊琛ㄧ殑filterable鍜宻ortable灞炴ц緗傚綋浣犻渶瑕侀櫎浜嗗琛ㄤ腑鐨勪竴銆佷袱鍒椾箣澶栫殑
鎵鏈夊垪榪涜榪囨護鍜屾帓搴忔椂錛屽崄鍒嗕究鍒┿?/p>
<ec:table items="presidents" action="${pageContext.request.contextPath}/presidents.run" >
<ec:row>
<ec:column property="firstName" filterable="false"/>
<ec:column property="lastName" sortable="false"/>
</ec:row>
</ec:table>
8銆傝鍥鵑棶棰橈細
viewsAllowed 灞炴у埗瀹氱被鍏佽浣跨敤鐨勮鍥俱傝鍥懼寘鎷細html銆乸df銆亁ls銆乧sv錛屼互鍙婁換浣曞畾鍒剁殑瑙嗗浘銆? 濡傛灉浣犳寚瀹氫竴涓垨鍑犱釜瑙嗗浘錛岄偅涔堝垪浠呰兘浣跨敤榪欎簺鎸囧畾鐨勮鍥俱備緥濡傦細浣犳寚瀹歷iewsAllowed="pdf"錛岃繖鎰忓懗鐫 榪欏垪鍙厑璁窹DF瀵煎嚭錛岃屼笉鑳借繘琛屽叾浠栨牸寮忕殑瀵煎嚭鎴杊tml瑙嗗浘銆?/p>
<ec:table items="presidents" action="${pageContext.request.contextPath}/presidents.run" >
<ec:row>
<ec:column property="firstName"/>
<ec:column property="lastName" viewsAllowed="pdf"/>
</ec:row
</ec:table>
viewsDenied
灞炴у埗瀹氱被涓嶅厑璁鎬嬌鐢ㄧ殑瑙嗗浘銆傝鍥懼寘鎷細html銆乸df銆亁ls銆乧sv錛屼互鍙婁換浣曞畾鍒剁殑瑙嗗浘銆?
濡傛灉浣犳寚瀹氫竴涓垨鍑犱釜瑙嗗浘錛岄偅涔堝垪浠呰繖浜涙寚瀹氱殑瑙嗗浘涓嶈兘琚嬌鐢ㄣ備緥濡傦細浣犳寚瀹歷iewsDenied="html"錛岃繖鎰忓懗鐫
榪欏垪涓嶅厑璁鎬嬌鐢╤tml璇曞浘錛屼絾鑳借繘琛屼換浣曞艦寮忕殑瀵煎嚭銆?/p>
<ec:table items="presidents" action="${pageContext.request.contextPath}/presidents.run" >
<ec:row>
<ec:column property="firstName"/>
<ec:column property="lastName" viewsDenied="html"/>
</ec:row>
</ec:table>
9銆侾arameterTag
eXtremeTable 鑳藉鎸囧畾鏄惁澶勭悊鎵鏈夌殑鍙傛暟銆傞粯璁や負澶勭悊鎵鏈夌殑鍙傛暟錛岃繖鎰忓懗鐫褰撲綘榪涜 榪囨護銆佹帓搴忋佸垎欏墊椂錛屾墍鏈夌殑鍙傛暟閮借eXtremeTable淇濆瓨騫朵紶鍒癑SP涓傞氬父榪欐槸浣犻渶瑕佺殑鍔熻兘錛? 鐒惰岋紝鏈夋椂鍊欎綘闇瑕佸彧鍏佽涓浜涚壒瀹氱殑鍙傛暟淇濆瓨鍒癳XtremeTable涓傛垜鍠滄鎶婂畠鐪嬩綔閿佸畾extremeTable錛? 鍙互閫氳繃璁劇疆琛ㄧ殑autoIncludeParameters灞炴у間負false鏉ュ埌杈劇洰鐨勶細
<ec:table
items="presidents"
action="${pageContext.request.contextPath}/presidents.run"
autoIncludeParameters=”false” >
...
</ec:table>
鐢氳嚦褰撹〃琚攣瀹氭椂錛屼綘浠嶇劧鍙互閫氳繃綆鍗曞湴浣跨敤parameter鏍囩鏉ュ寘鍚竴浜涗綘鎯充嬌鐢ㄧ殑鍙傛暟銆備笅渚?鍖呭惈浜唂oo鍙傛暟錛?/p>
<ec:table
items="presidents"
action="${pageContext.request.contextPath}/presidents.run"
autoIncludeParameters=”false” >
<ec:parameter name=”foo” value=”${param.foo}”/>
...
</ec:table>
鐜板湪鎵鏈夌殑eXtremeTable鍙傛暟閮借閿佸畾銆備絾榪囨護銆佹帓搴忓拰緲婚〉鏃訛紝foo鍙傛暟浠嶅皢琚紶閫掋?/p>
10. .propeties鍙栦唬
涓轟簡鏇夸唬紜紪鐮乪XtremeTable浣跨敤鐨勯粯璁ゅ睘鎬у鹼紝鎴戝湪灞炴ф枃浠朵腑閰嶇疆鎵鏈夌敤鍒扮殑灞炴с?濡傛灉浣犻渶瑕佽鐩栦換浣曢粯璁ょ殑璁劇疆錛屼綘鍙互鍒涘緩鑷繁鐨別xtremecomponents.properties鏂囦歡 騫惰緗綘鎯蟲敼鍙樼殑鍊箋?/p>
涓轟簡璁劇疆灞炴ф枃浠訛紝浣犲簲璇ュ涓嬩緥鎵紺哄湪/WEB-INF/web.xml鏂囦歡涓0鏄庝竴涓猚ontext-param錛屽茍 鎸囧畾浣犵殑灞炴ф枃浠剁殑璺緞錛?/p>
<context-param>
<param-name>extremecomponentsPreferencesLocation</param-name>
<param-value>/org/extremesite/resource/extremecomponents.properties</param-value></context-param>
浣犲彲浠ヨ涓哄睘鎬ф枃浠朵負浣犳彁渚涗簡涓涓鎵鏈夌殑eXtremeTables澹版槑鍏ㄥ眬璁劇疆鐨勪竴涓柟娉曘?鍒涘緩灞炴ф枃浠剁殑鏈澶уソ澶勫氨鏄伩鍏嶅湪鏍囩涓鍒躲佺矘璐寸浉鍚岀殑灞炴с傚吀鍨嬬殑extremecomponents.properties鏂囦歡濡備笅鎵紺猴細
table.imagePath=/extremesite/images/*.gif
table.rowsDisplayed=12
column.parse.date=yyyy-MM-dd
column.format.date=MM/dd/yyyy
column.format.currency=$###,###,##0.00
鍦ㄥ睘鎬ф枃浠跺畾涔夌殑TableTag浣跨敤鏈澶氱殑涓や釜灞炴ф槸錛歩magePath鍜宺owsDisplayed銆傚鏋滀綘涓嶅湪灞炴ф枃浠朵腑澹版槑 榪欎簺灞炴э紝浣犻渶瑕佸湪姣忎釜eXtremeTable涓坊鍔犱粬浠傚吀鍨嬬殑琛ㄥ涓嬫墍紺猴細
<ec:table
items="presidents"
action="${pageContext.request.contextPath}/presidents.run"
imagePath="${pageContext.request.contextPath}/images/*.gif"
rowsDisplayed="12" title="Presidents" > ...</ec:table>
濡傛灉鍦ㄥ睘鎬ф枃浠跺0鏄巌magePath鍜宺owsDisplayed錛屽垯琛ㄥ涓嬫墍紺猴細
<ec:table
items="presidents"
action="${pageContext.request.contextPath}/presidents.run"
title="Presidents" > ...</ec:table>
姝e浣犳墍瑙侊紝灞炴ф枃浠墮伩鍏嶄簡閲嶅緙栫爜銆?/p>
鍦ㄥ睘鎬ф枃浠跺畾涔夌殑ColumnTag浣跨敤鏈澶氱殑涓や釜灞炴ф槸錛歱arse鍜宖ormat銆傚鏋滀綘涓嶅湪灞炴ф枃浠朵腑澹版槑 榪欎簺灞炴э紝浣犻渶瑕佸湪姣忎釜eXtremeTable涓坊鍔犱粬浠傚吀鍨嬬殑鍒椾嬌鐢ㄦ棩鏈焎ell濡備笅鎵紺猴細
<ec:column property="dateOfBirth" cell=”date” parse=”yyyy-MM-dd” format=”MM/dd/yyyy”/>
濡傛灉鍦ㄥ睘鎬ф枃浠跺0鏄巔arse鍜宖ormat錛屽垯鍒楀涓嬫墍紺猴細
<ec:column property="dateOfBirth" cell=”date”/>
褰撶劧浣犱粛鐒跺彲浠ュ畾涔塸arse鍜宖ormat灞炴ф潵瑕嗙洊鍏ㄥ眬璁劇疆錛屼絾鏄ぇ澶氭暟宸ョ▼瀵逛簬鏃ユ湡浣跨敤涓鑷寸殑parse 鍜宖ormat銆傞渶瑕佹敞鎰忓睘鎬ф枃浠朵腑parse.date鍜宖ormat.date鐨勫0鏄庤娉曘?/p>
涓嬩緥涓轟嬌鐢ㄨ揣甯乧ell鐨勫吀鍨嬪垪錛?/p>
<ec:column property="salary" cell=”currency” format=”$###,###,##0.00”/>
濡傛灉鍦ㄥ睘鎬ф枃浠跺0鏄巉ormat錛屽垯鍒楀涓嬫墍紺猴細
<ec:column property="salary" cell=”currency”/>
鍙﹀錛屼綘鍙互澹版槑涓涓畾鍒剁殑format騫跺湪鍒椾腑閫氳繃浣跨敤鍒楃殑basis鏉ヤ嬌鐢ㄥ畠錛屾垜鎶婅繖鎯寵薄涓簄amed灞炴с傚洜姝ゅ鏋滀綘鐨?extremecomponents.properties鏂囦歡濡備笅鎵紺猴細
table.format.myCustomDate=yy-MM-dd
閭d箞鍒楀彲浠ュ涓嬩嬌鐢ㄥ畾鍒剁殑format錛?/p>
<ec:column property="dateOfBirth" cell="date" format=”myCustomDate”>
11銆侲xportTag
eXtremeTable 鍏鋒湁瀵煎嚭涓嶅悓鏍煎紡鏂囦歡鐨勫姛鑳斤紝瀵煎嚭鐨勬暟鎹負榪囨護鍜屾帓搴忓悗鐨勬墍鏈夌粨鏋滈泦錛? 鍒嗛〉涓嶄細褰卞搷榪斿洖鐨勭粨鏋滈泦銆傛崲鍙ヨ瘽璇達紝濡傛灉琛ㄦ暟鎹垎澶氶〉鏄劇ず錛岄偅涔堟墍鏈夐〉鐨勬暟鎹兘灝嗚瀵煎嚭銆?瀵煎嚭鐨勬牸寮忎負Microsoft Excel (OpenOffice Calc)銆丳DF鍜孋SV銆?/p>
浣跨敤ExportXlsTag瀵煎嚭Microsoft Excel (OpenOffice Calc)錛?/p>
<ec:table items="presidents" action="${pageContext.request.contextPath}/presidents.run" />
<ec:exportXls fileName="presidents.xls" tooltip="Export Excel"/>
...
</ec:table>
浣跨敤ExportPdfTag瀵煎嚭PDF銆傛墍鏈夎鍋氱殑灝辨槸鎸囧畾fileName灞炴у拰涓浜涙牱寮忓睘鎬э細
<ec:table items="presidents" action="${pageContext.request.contextPath}/presidents.run" />
<ec:exportPdf
fileName="presidents.pdf" tooltip="Export PDF"
headerColor="blue" headerBackgroundColor="red"
headerTitle="Presidents"/> ...
</ec:table>
浣跨敤ExportCsvTag瀵煎嚭CSV銆傚綋浣跨敤CSV瀵煎嚭鏄粯璁ょ殑鍒嗛殧絎︿負‘,’(comma)銆備綘鍙互浣跨敤 delimiter灞炴ф潵鎸囧畾涓哄叾浠栫殑絎﹀彿銆備笅闈負鎸囧畾‘|’錛坧ipe錛変負CSV鍒嗛殧絎︾殑紺轟緥錛?/p>
<ec:table items="presidents" action="${pageContext.request.contextPath}/presidents.run" />
<ec:exportCsv fileName="presidents.txt" tooltip="Export CSV" delimiter="|"/>
...
</ec:table>