The placement and order of the PivotTable's Fields in the PivotPanel affects the order of the values within the PivotTable. Users can drag the field values up or down within the areas (like the Rows area) to adjust which data appears first/last in the PivotTable.
In the PivotTable field, there are 4 kinds of fields:
Pivot Filter Fields
By default, the Report Filters are shown in a single vertical list at the top of the PivotTable. PivotTable supports the options of displayFieldsInPageFilterArea and reportFilterFieldsPerColumn to define the filter layout:
export enum GC.Spread.Pivot.DisplayFields {
/**
* prioritize in the vertical direction
*/
downThenOver,
/**
* prioritize in the horizontal direction
*/
overThenDown,
}
Pivot Row Fields
The row fields define the data distribution in the PivotTable, and it can be a tree when there are multiple row fields. When more than one field is placed in the row area, they will be expanded and displayed nested, and the field ranked first is expanded first. For the different layout types, the row field appearance will show the different tree appearances.
Pivot Column Fields
Column fields are similar to the row fields. It can be a tree when there are multiple column fields. When more than one field is placed in the column area, they will be expanded and displayed nested, and the field ranked first is expanded first.
Pivot Value Fields
The value range is the statistical data area. Through the value area, the user can choose the statistics data and summary types, like the PivotTable subtotal type.
PivotTable fields support the below APIs.
1.Users can get or set sorting for a field in the PivotTable.
///* function sort(fieldName: string, type?: GC.Pivot.SortType, customSortCallBack?: any): GC.Spread.Pivot.IPivotTableSortInfo | void
/**
* @description get or set sort for a field of pivot table.
* @param {string} fieldName The target field name.
* @param {GC.Pivot.SortType} type The sort type , may be asc or desc
* @param customSortCallBack custom function for custom sort
* @returns GC.Spread.Pivot.IPivotTableSortInfo
*/
sort (fieldName: string, type?: SortType, customSortCallBack?: any): IPivotViewSortInfo | void;
2.User can group or ungroup the items of the field.
///* function group(fieldName: string, groupInfo: GC.Spread.Pivot.IGroupInfo): void
/**
* @description group the items of field
* @param {string} fieldName the grouped field name
* @param {object} groupInfo the grouped info
*/
group (fieldName: string, groupInfo: any): void;
///* function ungroup(fieldName: string)
/**
* @description ungroup the field by field name
* @param {string} fieldName the ungroup field name
*/
ungroup (fieldName: string);
3.User can get or set collapse info for a field of PivotTable by field name.
///* function collapse(fieldName: string, item: string, isCollapse?: boolean): boolean | void
/**
* @description get or set collapse info for a field of pivot table.
* @param {string} fieldName The target field name.
* @param {string} item The collapse item name
* @param {boolean} isCollapse the status of the collapse
* @returns {boolean} whether is collapse
*/
collapse (fieldName: string, item: string, isCollapse?: boolean): boolean | void;
4.User can get or set label filter / value filter info of pivotTable by field name.
///* function labelFilter(fieldName: string, filterInfo: GC.Spread.Pivot.IPivotTextFilterInfo | GC.Spread.Pivot.IPivotConditionFilterInfo): GC.Spread.Pivot.IPivotTextFilterInfo | GC.Spread.Pivot.IPivotConditionFilterInfo | void
/**
* get or set label filter info for a field
* @param {string} fieldName the target field name of pivot table
* @param {object} filterInfo the label filter info when set
* @returns get pivot table labelFilter information
*/
labelFilter (fieldName: string, filterInfo?: IPivotFilterInfo): IPivotFilterInfo | void;
///* function valueFilter(fieldName: string, filterInfo: GC.Spread.Pivot.IPivotTextFilterInfo | GC.Spread.Pivot.IPivotConditionFilterInfo): GC.Spread.Pivot.IPivotTextFilterInfo | GC.Spread.Pivot.IPivotConditionFilterInfo | void
/**
* get or set value filter info for a field
* @param {string} fieldName the target field name of pivot table
* @param {object} filterInfo the value filter info when set
* @returns the pivot table value information
*/
valueFilter (fieldName: string, filterInfo?: IPivotFilterInfo): IPivotFilterInfo | void
5.User can get or set SubTotalType of the PivotTable by field.
///* function subTotalType (fieldName: string, type?: GC.Pivot.SubtotalType): void
/**
* get or set SubTotalType for a field
* @param {string} fieldName the target field name of pivot table
* @param {GC.Pivot.SubtotalType} type the SubTotalType
* @example
* pivotTable.subTotalType("fieldName", GC.Pivot.SubtotalType)
*/
subTotalType (fieldName: string, type?: SubtotalType): SubtotalType | void;
Submit and view feedback for