added dataUpdate event

This commit is contained in:
Gerard 2018-10-23 13:50:31 +02:00
parent e98e8cdb37
commit 82bdea09ae
1 changed files with 8 additions and 0 deletions

View File

@ -44,6 +44,10 @@ ngModule.component('vnDataModel', {
* made in model rows.
*
* @event dataChange Emitted when data property changes
* @event dataUpdate Emitted when data property changes
* @event rowInsert Emitted when new row is inserted
* @event rowRemove Emitted when row is removed
* @event rowChange Emitted when row property is changed
*/
export default class ModelProxy extends DataModel {
constructor($element, $scope) {
@ -83,6 +87,7 @@ export default class ModelProxy extends DataModel {
set data(value) {
this._data = value;
this.emit('dataChange');
this.emit('dataUpdate');
}
/**
@ -101,6 +106,7 @@ export default class ModelProxy extends DataModel {
this.isChanged = true;
this.emit('rowRemove', index);
this.emit('dataUpdate');
}
/**
@ -120,6 +126,7 @@ export default class ModelProxy extends DataModel {
this.isChanged = true;
this.emit('rowInsert', index);
this.emit('dataUpdate');
return index;
}
@ -139,6 +146,7 @@ export default class ModelProxy extends DataModel {
obj.$oldData[prop] = value;
this.isChanged = true;
this.emit('rowChange', {obj, prop, value});
this.emit('dataUpdate');
}
return Reflect.set(obj, prop, value);
}