private zcActionBegin(e): void { console.log('Action Begin : (' + this.name + ') ' + e.requestType ); switch (e.requestType) { case 'searching': e.cancel = true; // let service: object; // this.MyService$.getMyData$({ // searchCriteria : e.searchString // }).subscribe( // result => { // if (result != null) { // console.log('Searching ' + result) // this.zcGrid.dataSource = result; // } // } // ) break; case 'refresh': console.log(e) break; } } private zcActionComplete(e): void { console.log('Action Complete : (' + this.name + ') ' + e.requestType ); switch (e.requestType) { case 'searching': console.log(e.searchString) break; case 'refresh' : console.log(e) break; } } |
|
@Component({
selector: 'app-root',
template: `<ejs-grid #grid [dataSource]='data' [allowPaging]="true" [allowSorting]="true"
[allowFiltering]="true" [pageSettings]='pageSettings' (actionBegin)="zcActionBegin($event)"
(actionComplete)="zcActionComplete($event)" [toolbar]='toolbar'>
<e-columns>
. . .
</e-columns>
</ejs-grid>
<input type="button" value="Change Grid Value" (click)='testGridOnClick($event)'>`
})
export class AppComponent implements OnInit {
. . .
private testGridOnClick(e) {
debugger
this.data = [
. . .
];
this.grid.search(''); // resets the searching
}
private zcActionBegin(e): void {
console.log('Action Begin' + e.requestType);
switch (e.requestType) {
case 'searching':
e.cancel = true;
break;
case 'refresh':
console.log(e);
break;
}
}
} |