时光如水

我心跳动
posts - 6, comments - 10, trackbacks - 0, articles - 4
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

eXtremeComponent学习摘要

Posted on 2005-11-21 17:10 qiqijava 阅读(723) 评论(0)  编辑  收藏 所属分类: Tag
这个标签只是简单的使用,简单列出一些关键点。因为急于学习valueList,这个写得比较简单。

                               eXtremeComponent学习摘要
1. TableTag必须指定collection属性,值为bean名,它会在(page,request,session,application)中查找此bean,在table迭代显示列时,要通过bean在List中查找。在Web中传递的bean必须实现Serializable接口.
例1.
<ec:table collection="presidents">
  <ec:column property="firstName"/>最通用的显示方式,调用getFirstName()
  <ec:column property="lastName"/>
    ${presidents.lastName}另一种方式,直接读取lastName属性,另一种用途如下显示
    1)<a href="http://goto.president.detail">${pageScope.presidents.lastName}</a>
    2)<a href="http://goto.president.detail?firstName=${pageScope.presidents.firstName}">${pageScope.presidents.lastName}</a>
  </ec:column>
</ec:table>
例2.
<ec:table
  collection="presidents"
  imagePath="${pageContext.request.contextPath}/images/*.gif"
  action="${pageContext.request.contextPath}/presidents.run"
  title="Presisent" 指定表格的标题
  filterable="false"过滤
  sortable="false"排序
  saveFilterSort="true"用户操作完排序、过滤后下次再返回时看到相同的结果。要求:在url的参数中指定useSessionFilterSort=true
  >
  ...
</ec:table>所有的属性默认为全部打开。
2.默认一页显示15行,rowsDisplayed属性指定一页显示的行数。如果设置值为0将显示所有行。也可以通过设置showPagination=false来显示所有行。在TableTag中可以设置一些样式(style)属性
例3.
<ec:table
  collection="presidents"
  cellspacing="2" 表格有立体感
  cellpadding="0"
  border="0"
  width="80%"
  style=""指定内部样式
  styleClass=""分别指定css
  headerClass=""分别指定css
  />
 
3.ColumnTag
1)<ec:column property="born" cell="date" parse="yyyy-MM-dd" format="MM/dd/yyyy"/>
当born值为String时,要把String-->Date,需指定parse属性。format属性可对值格式化
当born值为Date时,无需指定parse属性
<ec:column property="payroll" cell="currency" format="###,###,##0.00"/>
大部分的时间、日期、贷币均可被格式化
2)可指定filterable,sortable属性,它们覆盖TableTag中的属性,只对指定的列进行过滤、排序。

4.Cell返回的每一列都是一个Object,它能被format,modify.Cell做为一个模板被缓存以便重复使用。
使用流程:1)初始化Cell
          2)getHtml()
          3)销毁全局变量等待再次使用
<ec:column property="firstName" cell="com.mycompany.cell.MyCell"/>
要使用自定义的Cell,只需要extend BaseCell或implements Cell接口即可,然后在columnTag中指定完全限定名。

5.ParameterTag
默认会把所有的参数全部传递,如果当你需要locking down table时,可通过指定autoIncludeParameters=”false”取消自动传递参数,转而通过设置<ec:parameter name=”foo” value=”${param.foo}”/>来传递参数。

6.ExportTag
可导出Excel、pdf、csv等格式,分页将无效,将把所有行全部导出。排序、过滤后的所有行将全部导出(排序、过滤有效)


只有注册用户登录后才能发表评论。


网站导航: