ASPxPivotGrid 属性

1.      数据绑定

1.1  SqlDataSource 设置(详见以前数据绑定)

1.2  点击ASPxPivotGrid,右键,在ASPxPivotGrid任务中-> Choose Data Source选择SqlDataSource1 .

1.3  点击 Fields ,弹出ASPxPivotGrid Fields Editor窗体。选择Retrieve fields,你选择的表所有字段都会列出,然后你可以增删你需要的列。

Behaviour ->Area中,选择好你的行和列以及统计的数值

ColumnArea:

RowArea :行

DataArea :数据值(必须为数字类型)

2.      外观与设计

2.1  头的可见性

ASPxPivotGrid控件提供4个属性去控制field头或者头区域。

ASPxPivotGrid1.OptionsView.ShowRowHeaders=True;

 

2.2  统计属性设置基于 OptionsView.TatalsLocation

RowTotalsLocation 值有Far,Near

2.3  水平滚动条

OptionView ->ShowHorizontalScrollBar =True

2.4  AspxPivotGrid控件能给你提供个性化的cell展示。

 protectedvoidASPxPivotGrid1_CustomCellStyle(objectsender,DevExpress.Web.ASPxPivotGrid.PivotCustomCellStyleEventArgse){
           
if(e.ColumnValueType==PivotGridValueType.Total||e.RowValueType==PivotGridValueType.Total)

//设置统计的颜色
            
e.CellStyle.BackColor=Color.FromArgb(213,227,230);

         }

3.      统计

3.1  单独统计

AspxPivotGrid自动为每行或者每列进行统计。同样统计可以自动计算每组的值

OptionsView 属性中有

ShowRowTotals ShowRowGrandTotals

ShowColumnTotalsShowColumnGrandTotals

3.2   Top

对于列值或者行值,你可以特别的设计去展示多少条记录和计算统计值

数据->TopValueCount = Number

 

3.3  统计排序

Height :排序值

Category:统计字段

PivotGridField selField = pivotGrid.Fields["Height"];

           if (selField ==null)return;

            selField.CellStyle.Font.Bold =true;

            pivotGrid.Fields["Category"].SortBySummaryInfo.FieldName = selField.FieldName;

            pivotGrid.Fields["Category "].SortBySummaryInfo.SummaryType = selField.SummaryType;

 

 

3.4   

4.      数据导出

ASPxPivotGridExporter1.ExportPdfToResponse(fileName,saveAs);

ASPxPivotGridExporter1.ExportXlsToResponse(fileName,saveAs)

ASPxPivotGridExporter1.ExportMhtToResponse(fileName,saveAs)

ASPxPivotGridExporter1.ExportRtfToResponse(fileName,saveAs)

ASPxPivotGridExporter1.ExportTextToResponse(fileName,saveAs);

 

5.      自定义过滤字段

  if (!IsPostBack && !IsCallback) {

                PivotGridField field = ASPxPivotGrid1.Fields["fieldgroupDesc"];

                // Locks the control to prevent excessive updates when multiple properties are modified.

               ASPxPivotGrid1.BeginUpdate();

                try {

                   // Clears the filter value collection and add two items to it.

                   field.FilterValues.Clear();

                   field.FilterValues.Add("A");

                   field.FilterValues.Add("B");

                   // Specifies that the control should only display the records

                   // which contain the specified values in the Country field.

                   field.FilterValues.FilterType = DevExpress.XtraPivotGrid.PivotFilterType.Included;

                }

                finally {

                   // Unlocks the control.

                   ASPxPivotGrid1.EndUpdate();

                }

            }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值