本文整理汇总了TypeScript中ag-grid/main.Utils.iterateObject方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Utils.iterateObject方法的具体用法?TypeScript Utils.iterateObject怎么用?TypeScript Utils.iterateObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ag-grid/main.Utils
的用法示例。
在下文中一共展示了Utils.iterateObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: recursivelyAddGroup
// parentChildren - the list of colDefs we are adding to
// @index - how far the column is from the top (also same as pivotKeys.length)
// @uniqueValues - the values for which we should create a col for
// @pivotKeys - the keys for the pivot, eg if pivoting on {Language,Country} then could be {English,Ireland}
private recursivelyAddGroup(parentChildren: (ColGroupDef|ColDef)[], pivotColumnDefs: ColDef[], index: number, uniqueValues: any,
pivotKeys: string[], columnIdSequence: NumberSequence, levelsDeep: number): void {
Utils.iterateObject(uniqueValues, (key: string, value: any)=> {
var newPivotKeys = pivotKeys.slice(0);
newPivotKeys.push(key);
var createGroup = index !== levelsDeep;
if (createGroup) {
var groupDef: ColGroupDef = {
children: [],
headerName: key
};
parentChildren.push(groupDef);
this.recursivelyAddGroup(groupDef.children, pivotColumnDefs, index+1, value, newPivotKeys, columnIdSequence, levelsDeep);
} else {
var measureColumns = this.columnController.getAggregationColumns();
var valueGroup: ColGroupDef = {
children: [],
headerName: key
};
parentChildren.push(valueGroup);
measureColumns.forEach( measureColumn => {
var colDef = this.createColDef(measureColumn, measureColumn.getColDef().headerName, newPivotKeys, columnIdSequence);
valueGroup.children.push(colDef);
pivotColumnDefs.push(colDef);
});
valueGroup.children.sort(this.headerNameComparator.bind(this));
}
parentChildren.sort(this.headerNameComparator.bind(this));
});
}
示例2: recursivelyAddGroup
// parentChildren - the list of colDefs we are adding to
// @index - how far the column is from the top (also same as pivotKeys.length)
// @uniqueValues - the values for which we should create a col for
// @pivotKeys - the keys for the pivot, eg if pivoting on {Language,Country} then could be {English,Ireland}
private recursivelyAddGroup(parentChildren: (ColGroupDef|ColDef)[], pivotColumnDefs: ColDef[], index: number, uniqueValues: any,
pivotKeys: string[], columnIdSequence: NumberSequence, levelsDeep: number): void {
Utils.iterateObject(uniqueValues, (key: string, value: any)=> {
var newPivotKeys = pivotKeys.slice(0);
newPivotKeys.push(key);
var createGroup = index !== levelsDeep;
if (createGroup) {
var groupDef: ColGroupDef = {
children: [],
headerName: key
};
parentChildren.push(groupDef);
this.recursivelyAddGroup(groupDef.children, pivotColumnDefs, index+1, value, newPivotKeys, columnIdSequence, levelsDeep);
} else {
var measureColumns = this.columnController.getNonDefaultAggregationColumns();
var valueGroup: ColGroupDef = {
children: [],
headerName: key
};
parentChildren.push(valueGroup);
// if no value columns selected, then we insert one blank column, so the user at least sees columns
// rendered. otherwise the grid would render with no columns (just empty groups) which would give the
// impression that the grid is broken
if (measureColumns.length===0) {
// this is the blank column, for when no value columns enabled.
var colDef = this.createColDef(null, '-', newPivotKeys, columnIdSequence, `'n/a'`);
valueGroup.children.push(colDef);
pivotColumnDefs.push(colDef);
} else {
measureColumns.forEach( measureColumn => {
var colDef = this.createColDef(measureColumn, measureColumn.getColDef().headerName, newPivotKeys, columnIdSequence, null);
valueGroup.children.push(colDef);
pivotColumnDefs.push(colDef);
});
}
valueGroup.children.sort(this.headerNameComparator.bind(this));
}
parentChildren.sort(this.headerNameComparator.bind(this));
});
}