File

projects/wms-framework/src/lib/models/controls/RowCollection.ts

Description

Collection of rows of the XamGrid.

Extends

BindableItemCollection

Index

Properties
Methods

Constructor

constructor(owner: IProvideDataItems<XamGridRow>, columnLayout: ColumnLayout)

Creates a new instance of RowCollection.

Parameters :
Name Type Optional
owner IProvideDataItems<XamGridRow> No
columnLayout ColumnLayout No

Properties

Private _columnLayout
Type : ColumnLayout

Internal reference of the ColumnLayout.

Protected _owner
Type : IProvideDataItems<T>
Inherited from BindableItemCollection

Owner of the data that the collection manipulates.

CollectionChanged
Type : SubscriptionEvent<void>
Default value : new SubscriptionEvent()
Inherited from BindableItemCollection

Event that handles the change of the collection

internalArray
Type : T[]
Inherited from BindableItemCollection

Internal array used in case the used needs a array instead of the current class

PropertyChanged
Type : SubscriptionEvent<void>
Inherited from BindableItemCollection

Event that gets fired when a property changes.

Methods

clear
clear()
Inherited from BindableItemCollection

Clears the row collection.

Returns : void
insert
insert(index: number, value: XamGridRow)
Inherited from BindableItemCollection

Insert an element in the data owner in a specific index.

Parameters :
Name Type Optional
index number No
value XamGridRow No
Returns : void
remove
remove(value: XamGridRow)
Inherited from BindableItemCollection

Remove an element in the data owner.

Parameters :
Name Type Optional
value XamGridRow No
Returns : boolean

{boolean}

toArray
toArray()

Convert the collection to a simple array.

Returns : any[]
add
add(item: any)
Inherited from BindableItemCollection

Add an item in the owner of the data

Parameters :
Name Type Optional
item any No
Returns : void
addItemSilently
addItemSilently(index: number, value: T)
Inherited from BindableItemCollection

To Implement

Parameters :
Name Type Optional
index number No
value T No
Returns : void
contains
contains(value: T)
Inherited from BindableItemCollection

To implement

Parameters :
Name Type Optional
value T No
Returns : boolean

{boolean}

copyTo
copyTo(target: T[], index: number)
Inherited from BindableItemCollection

To implement

Parameters :
Name Type Optional
target T[] No
index number No
Returns : void
getItem
getItem(index: number)
Inherited from BindableItemCollection

Get an item from the owner of the data

Parameters :
Name Type Optional
index number No
Returns : any

{*}

indexOf
indexOf(value: T)
Inherited from BindableItemCollection

To implement

Parameters :
Name Type Optional
value T No
Returns : number

{number}

removeAt
removeAt(index: number)
Inherited from BindableItemCollection

To implement

Parameters :
Name Type Optional
index number No
Returns : void
removeItemSilently
removeItemSilently(index: number)
Inherited from BindableItemCollection

To implement

Parameters :
Name Type Optional
index number No
Returns : void
resetItemsSilently
resetItemsSilently(index: number)
Inherited from BindableItemCollection

To implement

Parameters :
Name Type Optional
index number No
Returns : void
setItem
setItem(index: number, value: T)
Inherited from BindableItemCollection

To implement

Parameters :
Name Type Optional
index number No
value T No
Returns : void
sort
sort()
Inherited from BindableItemCollection

To implement

Returns : any
()
Inherited from BindableItemCollection

Iterator of the iterable class

Returns : Iterator<T, any, undefined>

{Iterator<T, any, undefined>}

import { XamGridRow } from './XamGridRow';
import { BindableItemCollection } from './BindableItemCollection';
import { ColumnLayout } from './ColumnLayout';
import { IProvideDataItems } from './IProvideDataItems';
import { iuAny } from '../../baseframework/collections';

/**
 * Collection of rows of the XamGrid.
 *
 * @export
 * @class RowCollection
 * @extends {BindableItemCollection<XamGridRow>}
 * @wType Infragistics.Controls.Grids.RowCollection
 */
export class RowCollection extends BindableItemCollection<XamGridRow> {
  /**
   * Internal reference of the ColumnLayout.
   *
   * @private
   * @type {ColumnLayout}
   * @memberof RowCollection
   */
  private _columnLayout: ColumnLayout;

  /**
   * Creates a new instance of RowCollection.
   *
   * @param {IProvideDataItems<XamGridRow>} owner
   * @param {ColumnLayout} columnLayout
   * @memberof RowCollection
   */
  constructor(
    owner: IProvideDataItems<XamGridRow>,
    columnLayout: ColumnLayout
  ) {
    super(owner);
    this._columnLayout = columnLayout;
  }

  /**
   * Convert the collection to a simple array.
   *
   * @type {any[]}
   * @memberof RowCollection
   */
  toArray(): any[] {
    return this._owner.toArray();
  }

  /**
   * Clears the row collection.
   *
   * @type {void}
   * @memberof RowCollection
   */
  clear(): void {
    this._owner.Clear();
  }

  /**
   * Insert an element in the data owner in a specific index.
   *
   * @param {number} index
   * @param {XamGridRow} value
   * @memberof RowCollection
   */
  insert(index: number, value: XamGridRow): void {
    super.insert(index, value);
    if (value != null) {
      value.Index = index;
    }
  }

  /**
   * Remove an element in the data owner.
   *
   * @param {XamGridRow} value
   * @return {*}  {boolean}
   * @memberof RowCollection
   */
  remove(value: XamGridRow): boolean {
    const selectedRows =
      this._columnLayout.Grid.SelectionSettings?.SelectedRows;
    if (
      selectedRows &&
      iuAny(selectedRows, (row) => value == row || value.Data === row.Data)
    ) {
      selectedRows.remove(value);
    }
    return super.remove(value);
  }
}

result-matching ""

    No results matching ""