File

projects/i-components/src/lib/utils/grid.ts

Description

GridUtils is a class that unifies XamGrid and DataGrid shared behaviors

Index

Methods

Methods

Static getGridUsedWidth
getGridUsedWidth(columns: IgxColumnComponent[], start: number, end: number)

Gets the remaining available space in true pixels of only rendered columns

Parameters :
Name Type Optional Description
columns IgxColumnComponent[] No
start number No

from index

end number No

to index, not inclusive

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);
  }
}

result-matching ""

    No results matching ""