|
export class AppComponent {
@ViewChild('sample')
public listObj: DropDownListComponent;
public sportsData: Object[] = [
{ Id: 'Game1', Game: 'American Football' },
{ Id: 'Game2', Game: 'Badminton' },
{ Id: 'Game3', Game: 'Basketball' },
{ Id: 'Game4', Game: 'Cricket' },
{ Id: 'Game5', Game: 'Football' },
{ Id: 'Game6', Game: 'Golf' },
];
public fields: Object = { text: 'Game', value: 'Id' };
public onOpen(args: any): void {
document.getElementsByClassName('e-input-filter')[0].addEventListener("keydown", this.myFunction);
}
public myFunction(e) {
if ((e.keyCode >= 32 && e.keyCode <= 126) && e.ctrlKey) {
alert('ctrl+ key is pressed');
};
}
}
|
|
export class AppComponent {
@ViewChild('default')
public multiObj: MultiSelectComponent;
// define the JSON of filtering data
public data: { [key: string]: Object; }[] = [
{ Name: 'Australia', Code: 'AU' },
{ Name: 'Bermuda', Code: 'BM' },
{ Name: 'Canada', Code: 'CA' },
{ Name: 'Cameroon', Code: 'CM' },
{ Name: 'Denmark', Code: 'DK' },
{ Name: 'France', Code: 'FR' },
{ Name: 'Finland', Code: 'FI' },
{ Name: 'Germany', Code: 'DE' },
{ Name: 'Greenland', Code: 'GL' },
{ Name: 'Hong Kong', Code: 'HK' }
];
public query: Query = new Query();
public fields: Object = { text: 'Name', value: 'Code' };
public watermarks: string = 'Select countries';
public onCreate(args: any): void {
this.multiObj.element.addEventListener("keydown", this.myFunction);
}
public myFunction(e) {
if ((e.keyCode >= 32 && e.keyCode <= 126) && e.ctrlKey) {
alert('ctrl+ key is pressed');
};
}
}
|