projects/wms-framework/src/lib/models/controls/RowBaseCollection.ts
Class representing the RowBaseCollection.
Properties |
|
Methods |
Accessors |
constructor(collection: ICollectionBase
|
||||||
Creates a new instance of RowBaseCollection
Parameters :
|
Private _actualCollection |
Type : ICollectionBase<any>
|
Internal actual collection |
PropertyChanged |
Type : SubscriptionEvent<void>
|
Default value : new SubscriptionEvent()
|
Subscription event to notify that a property have changed |
ActualCollection_CollectionChanged | |||||||||
ActualCollection_CollectionChanged(sender: any, e: CollectionChangeInfo)
|
|||||||||
Callback function when the actual collection have changed
Parameters :
Returns :
void
|
Clear |
Clear()
|
Clears collection
Returns :
void
|
OnPropertyChanged | ||||||
OnPropertyChanged(info: literal type)
|
||||||
Notify that some property have changed
Parameters :
Returns :
void
|
ActualCollection |
getActualCollection()
|
Gets the collection
Returns :
ICollectionBase<any>
|
import { INotifyPropertyChanged } from '../../basecomponentmodel/INotifyPropertyChanged';
import {
CollectionChangeAction,
CollectionChangeInfo,
} from '../../baseframework/collections';
import { SubscriptionEvent } from '../../utils';
import { ICollectionBase } from './ICollectionBase';
/**
* Class representing the RowBaseCollection.
*
* @export
* @class RowBaseCollection
* @implements INotifyPropertyChanged
* @wType Infragistics.Controls.Grids.Primitives.RowBaseCollection
*/
export class RowBaseCollection implements INotifyPropertyChanged {
/**
* Internal actual collection
*
* @type {ICollectionBase<any>}
* @memberof RowBaseCollection
*/
private _actualCollection: ICollectionBase<any>;
/**
* Creates a new instance of RowBaseCollection
*
* @param {ICollectionBase<any>} collection
* @memberof RowBaseCollection
*/
constructor(collection: ICollectionBase<any>) {
this._actualCollection = collection;
this._actualCollection.CollectionChanged.addHandler(
this.ActualCollection_CollectionChanged,
this
);
}
/**
* Subscription event to notify that a property have changed
*
* @type {SubscriptionEvent}
* @memberof RowBaseCollection
*/
PropertyChanged: SubscriptionEvent<
(o: any, args: { PropertyName: string }) => void
> = new SubscriptionEvent();
/**
* Gets the collection
*
* @readonly
* @type {ICollectionBase<any>}
* @memberof RowBaseCollection
*/
get ActualCollection(): ICollectionBase<any> {
return this._actualCollection;
}
/**
* Notify that some property have changed
*
* @type {any}
* @memberof RowBaseCollection
* @wIgnore
*/
/* istanbul ignore next */
OnPropertyChanged(info: { PropertyName: string }): void {
if (this.PropertyChanged == null) {
return;
}
this.PropertyChanged.fire([this, info]);
}
/**
* Callback function when the actual collection have changed
*
* @param {any} sender
* @param {CollectionChangeInfo} e
* @type {void}
* @memberof RowBaseCollection
* @wIgnore
*/
/* istanbul ignore next */
ActualCollection_CollectionChanged(
sender: any,
e: CollectionChangeInfo
): void {
if (e.action === CollectionChangeAction.Reset) {
this.Clear();
}
this.OnPropertyChanged({ PropertyName: 'Count' });
}
/**
* Clears collection
*
* @type {void}
* @memberof RowBaseCollection
*/
Clear(): void {
this._actualCollection.clear();
}
}