@@ -1040,6 +1040,18 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
1040
1040
}
1041
1041
}
1042
1042
1043
+ /**
1044
+ * Inserts dimension in target collection by type at specified index or at the collection's end.
1045
+ *
1046
+ * @example
1047
+ * ```typescript
1048
+ * this.grid.insertDimensionAt(dimension, PivotDimensionType.Row, 1);
1049
+ * ```
1050
+ * @param dimension The dimension that will be added.
1051
+ * @param targetCollectionType The target collection type to add to. Can be Row, Column or Filter.
1052
+ * @param index The index in the collection at which to add.
1053
+ * This parameter is optional. If not set it will add it to the end of the collection.
1054
+ */
1043
1055
public insertDimensionAt ( dimension : IPivotDimension , targetCollectionType : PivotDimensionType , index ?: number ) {
1044
1056
const targetCollection = this . getDimensionsByType ( targetCollectionType ) ;
1045
1057
if ( index !== undefined ) {
@@ -1054,13 +1066,36 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
1054
1066
this . dimensionsChange . emit ( { dimensions : targetCollection , dimensionCollectionType : targetCollectionType } ) ;
1055
1067
}
1056
1068
1069
+ /**
1070
+ * Move dimension from its currently collection to the specified target collection by type at specified index or at the collection's end.
1071
+ *
1072
+ * @example
1073
+ * ```typescript
1074
+ * this.grid.moveDimension(dimension, PivotDimensionType.Row, 1);
1075
+ * ```
1076
+ * @param dimension The dimension that will be moved.
1077
+ * @param targetCollectionType The target collection type to move it to. Can be Row, Column or Filter.
1078
+ * @param index The index in the collection at which to add.
1079
+ * This parameter is optional. If not set it will add it to the end of the collection.
1080
+ */
1057
1081
public moveDimension ( dimension : IPivotDimension , targetCollectionType : PivotDimensionType , index ?: number ) {
1058
1082
// remove from old collection
1059
1083
this . removeDimension ( dimension ) ;
1060
1084
// add to target
1061
1085
this . insertDimensionAt ( dimension , targetCollectionType , index ) ;
1062
1086
}
1063
1087
1088
+ /**
1089
+ * Removes dimension from its currently collection.
1090
+ * @remarks
1091
+ * This is different than toggleDimension that enabled/disables the dimension.
1092
+ * This completely removes the specified dimension from the collection.
1093
+ * @example
1094
+ * ```typescript
1095
+ * this.grid.removeDimension(dimension);
1096
+ * ```
1097
+ * @param dimension The dimension to be removed.
1098
+ */
1064
1099
public removeDimension ( dimension : IPivotDimension ) {
1065
1100
const prevCollectionType = this . getDimensionType ( dimension ) ;
1066
1101
const prevCollection = this . getDimensionsByType ( prevCollectionType ) ;
@@ -1072,14 +1107,24 @@ export class IgxPivotGridComponent extends IgxGridBaseDirective implements OnIni
1072
1107
this . pipeTrigger ++ ;
1073
1108
}
1074
1109
1110
+ /**
1111
+ * Toggles the dimension's enabled state on or off.
1112
+ * @remarks
1113
+ * The dimension remains in its current collection. This just changes its enabled state.
1114
+ * @example
1115
+ * ```typescript
1116
+ * this.grid.toggleDimension(dimension);
1117
+ * ```
1118
+ * @param dimension The dimension to be toggled.
1119
+ */
1075
1120
public toggleDimension ( dimension : IPivotDimension ) {
1076
1121
const dimType = this . getDimensionType ( dimension ) ;
1077
1122
const collection = this . getDimensionsByType ( dimType ) ;
1078
1123
dimension . enabled = ! dimension . enabled ;
1079
1124
if ( dimType === PivotDimensionType . Column ) {
1080
1125
this . setupColumns ( ) ;
1081
1126
}
1082
- if ( ! dimension . enabled ) {
1127
+ if ( ! dimension . enabled ) {
1083
1128
this . filteringService . clearFilter ( dimension . memberName ) ;
1084
1129
}
1085
1130
this . pipeTrigger ++ ;
0 commit comments