projects/i-components/src/lib/utils/grid.ts
GridUtils is a class that unifies XamGrid and DataGrid shared behaviors
Methods |
|
Static getGridUsedWidth | ||||||||||||||||
getGridUsedWidth(columns: IgxColumnComponent[], start: number, end: number)
|
||||||||||||||||
Gets the remaining available space in true pixels of only rendered columns
Parameters :
Returns :
number
|
import { IgxColumnComponent } from 'igniteui-angular';
/**
* GridUtils is a class that unifies XamGrid and DataGrid shared behaviors
*
* @export
* @class GridUtils
*/
// @dynamic
export class GridUtils {
/**
* Gets the remaining available space in true pixels of only rendered columns
*
* @param {IgxColumnComponent[]} columns
* @param start from index
* @param end to index, not inclusive
* @returns {number}
* @memberof GridUtils
*/
static getGridUsedWidth(
columns: IgxColumnComponent[],
start: number,
end: number
): number {
return columns
.slice(start, end)
.filter((col) => col.visibleIndex >= 0)
.map((col) => col.calcPixelWidth)
.reduce((acc, cur) => acc + cur, 0);
}
}