`
sbiigu
  • 浏览: 160310 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

extreme Table 使用

    博客分类:
  • js
阅读更多
  ExtremeTable

转自:http://www.springside.org.cn/docs/reference/ExtremeTable.htm

江南白衣  <http://calvin.blogjava.net>


    0.概述

    Home Page:http://www.extremecomponents.org

     Extreme Table是最功能强大而又容易配置,扩展,自定义的Table 控件。

     最紧要的功能包括排序, 分页, 导出Excel, pdf和汇总。

     springside的best 示例代码在: listBook.jsp和listOrder.jsp.

基础读物:

     1. ExtremeTable自带的文档
<http://extremecomponents.org/wiki/index.php/Main_Page> .

     2.Luck翻译的ExtremeTable官方文档中文版
<http://extremecomponents.org/wiki/index.php/Simplified_Chinese>  


    1. 安装


      1.1 安装原始版本

     1. 从http://www.extremecomponents.org 下载最新版

     2.把extremecomponents.jar 放入web-inf/lib

     3.根据minum, 导出excel 或 导出pdf的需要,把/lib下的jar copy到web-
inf/lib

     4.把images里的图片放入web的任意目录

     5.把css文件放到web的任意目录

     6.在/source/org/extremecomponents/table/core目录找到
extremetable.properties文件,把它复制到WEB-INF/classes里面并进行修改.

     7.修改web.xml (见2)。


       0.2 复制SpringSide的样式

     1.Copy springside的Table Head的图,查。

     2.将springside中的修改版extremecomponents.css文件放入任意目录

     3.把/src/resource/extremetable.properties 复制到对应目录


      0.3 使用Compact View很重要

     默认的式样不符合大家的审美,幸亏还有Compact View和css设置,让我们可
以敬谢不敏它号称非常方便的HtmlView子类扩展。

    1. 在全局设置里


table.view.html=org.extremecomponents.table.view.CompactView

    2.把images里/table/compact/*.gif copy 到 /table


    2.全局属性配置

   ExtremeTable支持在properties文件里方便的统一配置丰富的全局属性

  在/source/org/extremecomponents/table/core目录找到
extremetable.properties文件,把它复制到WEB-INF/classes里面.

在web.xml里面增加

   <context-param>
        <param-name>extremecomponentsPreferencesLocation</param-name>
        <param-value>/extremetable.properties</param-value>
   </context-param>

一般只写需要修改的文件:

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


    3.导出Excel

    注意Excel 导出的Tag已改为,且官方版不支持中文文件名。

    <ec:exportXls fileName="BookList.xls" tooltip="导出 Excel"/>

在web.xml必须加入:

    <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导出的一项重要特性是可以根据不同的View导出不同的列.

     比如html管理界面可能只列出订单几个最重要的列,而导出excel时则需要导
出所有的列。

<ec:column property="orderdate" title="订单日期"  cell="date" format="yyyy-MM-dd"  viewsDenied= "html"/>

又比如有些操作按纽的列只想在html出现,excel里不想出现:

<ec:column property="orderdate" title="订单日期" viewAllowed= "html"/>

     以上订单日期列在html view看不到,而excel,pdf view可以见到.

    而"编辑图标","选择Checkbox"这些管理界面上的列,也可以设置不export到
pdf,excel view


    4.其他要点


      4.1. 使用排序功能时,如果property为嵌套属性时,需要设置alias

          因为javascript的关系.

<ec:column property="customer.name" title="客户名称" alias="customer"/>


      4.2. Date Cell与NumberCell 和RowCountCell

     在全局属性定义:

column.format.date= yyyy-MM-dd
column.format.currency= ¥###,###,#00.00

<ec:column property="totalprice" title="总金额" cell="currency" width="80" />
<ec:column property="shipdate" title="发货日期"  cell="date" width= "80"/>
<e

其中RowCountCell用于显示序号。


      4.3. 汇总

在column中加入两个cac属性,就会自动在table的底端显示汇总

<ec:column property="totalprice" title="总金额" cell="number" format="###,###,##0.00" calc="total" calcTitle= "汇总:"/>


      4.4 i18N

在Web.xml里面指定i18N的Properties文件

<context-param>
  <param-name>extremecomponentsMessagesLocation</param-name>
  <param-value>messages</param-value>
</context-param>

<ec:column property="name" title="book.name"/>


      4.5数据库分页

EC默认从数据库中查找所有记录然后由它来分页,如果查询结果较大,可以考虑
使用数据库端分页的方案。

此时,EC会使用Limit对象向Controller传递PageNo,PageSize,OrderBy等分页信
息。而服务端将向EC返回总记录数和当前页的内容,具体请参看 BookController。


      4.6不显示导出excel及分页

最快的方式是设置table的showStatusBar= false

<ec:table  items= "order.orderItems"var="item" action=""   showStatusBar= "false">


          4.7ImagePath

  旧版EC包括其文档都在每个table tag里定义ImagePath, 新版已经可以自动插入
ContextPath,只需在properties文件定义table.imagePath=/images/table/*.gif即可


    5.自定义及扩展

   ExtremeTable比Display Tag的i一个就是良好的自定义和扩展能力,不用千人
一面。
   不过,人总是懒的,虽然扩展子类很容易,但能不扩展就还是不可扩展了。幸
亏用Compact View再改改CSS一般就能达到要求。


       5.1. 良好的CSS定义

         ExtremeTable 的CSS定义非常严谨, 并且提供很多个层次的修改方式:

         1.直接修改css文件, 可以把table view改成任意样式

         2.修改全局属性, 改变某种元素对应的css class名

table.styleClass=tableRegion

         3.在某个页面的row,column tag中定义class

<ec:row style="" or styleClass=""/>

        SpringSide采用层次1, 直接修改extremecomponents.css为合适的样式


      5.2方便的<tr><td>属性扩展

        row与column已提供了丰富的普通属性与 javascript属性如onClick(),
如果属性仍然未够,可自行扩展<row>与<column>tag ,并通过全局属性指定新的子
类名。

   为了方便大家在子类扩展属性, extreme Table提供了专门的回调函数与Util函数如

public void addColumnAttributes(Column column) {
   column.addAttribute("customAttributeOne", customAttributeOne);
}  

       

详细请看手册,Table, Row,Column都提供相同的扩展:
http://extremecomponents.org/wiki/index.php/Column#Extended_Attributes

如果不是Extremetable的特别支持, 普通taglib class要扩展属性的话:
        1.定义真正的Java属性,setter,getter
        2. tld文件中声明新的属性
        3.重载输出函数将新属性打印出来


      5.3 扩展HTMLView,cell 等显示组件

     Extreme Table在这些类的扩展上放便很多,但这个版本里我还没有进行尝
试,就不写了。请自行参考官方文档:http://extremecomponents.org/wiki
/index.php/Html_View_Tutorial .



返回目录 <http://www.springside.org.cn/docs/Reference.htm> 51.la 专业、
免费、强健的访问统计 <http://www.51.la/?00253758>
SourceForge.net Logo <http://sourceforge.net/projects/springside/>

分享到:
评论

相关推荐

    eXtremeComponents

    ExtremeComponents 指南 Extreme Table是功能最强大而又容易配置、扩展、自定义的Table 控件,比DisplayTag要优秀一些

    Cody‘s_Data_Cleaning_Techniques_Using_SAS_(Second_Edtion)

    Table of Contents List of Programs ix Preface xv Acknowledgments xvii Checking Values of Character Variables Introduction 1 Using PROC FREQ to List Values 1 Description of the Raw Data File PATIENTS....

    Learning.Agile.Understanding.Scrum.XP.Lean.and.Kanban

    This practical book helps you sort it out, first by grounding you in agile’s underlying principles, then by describing four specific—and well-used—agile methods: Scrum, extreme programming (XP), ...

    An automated, 0.5 Hz nano-foil target positioning system for intense laser plasma experiments

    Integrating our prototype into the table-top ATLAS 300 TW-laser system at the Laboratory for Extreme Photonics in Garching, we demonstrate the operation of a 0.5 Hz laser-driven proton sou

    Writing.High-Performance..NET.Code.0990583430

    It will expertly guide you through the nuts and bolts of extreme performance optimization in .NET, complete with in-depth examinations of CLR functionality, free tool recommendations and tutorials, ...

    Natural Language Processing in Action

    Recent advances in deep learning empower applications to understand text and speech with extreme accuracy. The result? Chatbots that can imitate real people, meaningful resume-to-job matches, superb ...

    Practical Convolutional Neural Networks Implement advanced d l models using Py

    Table of ContentsDeep Neural Networks - OverviewIntroduction to Convolutional Neural NetworksBuild Your First CNN and Performance OptimizationPopular CNN Model's ArchitecturesTransfer ...

    Practical Machine Learning Cookbook

    In the field of quantitative finance, he has developed models for Value at Risk, Extreme Value Theorem, Option Pricing, and Energy Derivatives using Monte Carlo simulation techniques. Table of ...

    Node.js Design Patterns_Second Edition

    It allows you to create efficient code, enabling a more sustainable way of writing software made of only one language across the full stack, along with extreme levels of reusability, pragmatism, ...

    Hybird AI System 13th International conference

    Table of Contents Chapter 1. A Deep Learning-Based Recommendation System to Enable End User Access to Financial Linked Knowledge Chapter 2. On the Use of Random Discretization and Dimensionality ...

    Python.Data.Science.Cookbook.178439640

    It also covers the principles of shrinkage, ensemble methods, random forest, rotation forest, and extreme trees, which are a must-have for any successful Data Science Professional. Style and ...

    Artificial.Intelligence.and.Soft.Computing.17th.International.Conference.Part.I

    Table of Contents Chapter 1. Three-Dimensional Model of Signal Processing in the Presynaptic Bouton of the Neuron Chapter 2. The Parallel Modification to the Levenberg-Marquardt Algorithm Chapter 3. ...

    jQuery完全实例.rar

    jQuery中的一切都构建于这个函数之上,或者说都是在以某种方式使用这个函数。这个函数最基本的用法就是向它传递一个表达式(通常由 CSS 选择器组成),然后根据这个表达式来查找所有匹配的元素。 默认情况下, 如果...

    Conceptual designs of a laser plasma accelerator-based EUV-FEL and an all-optical Gamma-beam source

    Here we present conceptual designs of an extreme ultraviolet radiation source for next-generation lithography and a laser Compton Gamma-beam source for nuclear physics research on a table-top scale.

    EUV ablation of organic polymers at a high fluence

    wavelength ablation mechanisms of poly(methyl methacrylate) (PMMA) and poly (1,4-phenylene ether ether-sulfone) (PPEES) by extreme ultraviolet (EUV) radiation at 13.5 nm using a table-top ...

    Diskeeper 2008 v12.0.759.0

    extreme of conditions Diskeeper 2008 introduces the most powerful defragmentation engine ever developed. Even if your systems only have a percent or two of free space left available or a file ...

    大维随机矩阵的谱分析理论

    Table 0.1 Publication numbers on rMT in 10 year periods since 1955 1955-19641965-19741975-19841985-199419952004 138 249 0.5 1205 Modern developments in computer science and computing facilities moti- ...

    degital electronics

    11.11.1 Excitation Table of a Flip-Flop 438 11.11.2 State Transition Diagram 439 11.11.3 Design Procedure 439 11.12 Shift Register 447 11.12.1 Serial-In Serial-Out Shift Register 449 11.12.2 Serial-In...

    建伍378G写频软件

    When narrow is selected, the dot mark "." displayed at the extreme right of transceiver display. (E TYPE) First tune all item in the wide 5k mode. Then tune QT VCO BAL. QT TCXO BAL. DQT VCO BAL. DQT...

Global site tag (gtag.js) - Google Analytics