pivotColumn构件不能单独使用,它是作为pivotGrid组件的子组件存在的,用来设置pivotGrid的统计字段
表 30.113. 构件信息
| Component Type | org.operamasks.faces.component.grid.impl.UIPivotColumn |
| Component Class | org.operamasks.faces.component.grid.impl.UIPivotColumn |
| Tag Class | org.operamasks.faces.webapp.grid.UIPivotColumnTag |
+java.lang.Object
++javax.faces.component.UIComponent
+++javax.faces.component.UIComponentBase
++++org.operamasks.faces.component.grid.UIPivotColumnBase
+++++org.operamasks.faces.component.grid.impl.UIPivotColumn
表 30.114. 属性
| binding | 定义类 | javax.faces.component.UIComponentBase | ||
| 类型 | javax.el.ValueExpression(javax.faces.component.UIComponent) | |||
| 是否必须 | 否 | 延时求值 | 是 | |
| 一个值表达式,用于把该组件链接到一个ManagedBean的某个属性。 | ||||
| id | 定义类 | javax.faces.component.UIComponentBase | ||
| 类型 | java.lang.String | |||
| 是否必须 | 否 | 延时求值 | 否 | |
| 这个组件的组件标识符。这个值在最近的命名容器类型的父组件范围内,必须是唯一的。 | ||||
| rendered | 定义类 | javax.faces.component.UIComponentBase | ||
| 类型 | boolean(boolean) | |||
| 是否必须 | 否 | 延时求值 | 是 | |
| 一个标志,指出该组件是否要在任何随后的form提交过程中被渲染或处理。 这个属性的缺省值是true。 | ||||
| type | 定义类 | org.operamasks.faces.component.grid.impl.UIPivotColumn | ||
| 类型 | javax.el.ValueExpression(java.lang.String) | |||
| 是否必须 | 否 | 延时求值 | 是 | |
| pivotGrid的表头类型,值为leftAxis、measure和topAxis | ||||
| value | 定义类 | org.operamasks.faces.component.grid.impl.UIPivotColumn | ||
| 类型 | javax.el.ValueExpression(java.lang.String) | |||
| 是否必须 | 否 | 延时求值 | 是 | |
| 设置的表头属性对象值 | ||||
| width | 定义类 | org.operamasks.faces.component.grid.impl.UIPivotColumn | ||
| 类型 | javax.el.ValueExpression(java.lang.String) | |||
| 是否必须 | 否 | 延时求值 | 是 | |
| 当type为leftAxis的时候可以设置宽的值 | ||||
下面是一个简单的二维统计表代码
//----------------xhtml页面---------------------------------------
<w:pivotGrid id="test" title="用户收入统计表" aggregator="sum" measure="incoming" firstCellTitle="性别和支出" height="350">
<w:pivotColumn type="leftAxis" value="sex" width="150"/>
<w:pivotColumn type="leftAxis" value="outcoming" width="150"/>
<w:pivotColumn type="topAxis" value="age"></w:pivotColumn>
</w:pivotGrid>
//---------------------------------liteBean------------------------
@Bind(id="test")
public List<UserEntity> getList()
{
return companys;
}
private List<UserEntity> companys = new ArrayList<UserEntity>(Arrays.asList(new UserEntity[]{
new UserEntity("luoyg","湖南","男",30,3000,4000),
new UserEntity("chenjie","湖北","男",20,8000,4000),
new UserEntity("zhoufazhi","湖北","男",28,12000,7000),
new UserEntity("zhangsan","贵州","女",20,12000,7000),
new UserEntity("lili","北京","女",28,12000,7000),
new UserEntity("liyingying","江苏","女",28,12000,7000)
}));
//---------------------------------UserEntity类------------------------
UserEntity就省略啦,下面是它的字段
private String name;
private String address;
private String sex;
private Integer age;
private Integer incoming;
private Integer outcoming;