HTML:
<ejs-grid #grid [dataSource]='data' allowPaging='true' allowFiltering='true' [pageSettings]='pageSettings' [filterSettings]='filterSettings'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right'></e-column>
<e-column field='OrderDate' headerText='Order Date' width='130' [format]='formatoptions' textAlign='Right'></e-column>
<e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right'></e-column>
</e-columns>
</ejs-grid>
TS:
export class AppComponent {
public data: Object[];
public ddldata: Object[];
public pageSettings: Object;
public filterSettings: Object;
public filteringType: Object[] = [
{ Id: 'Menu', type: 'Menu' },
{ Id: 'CheckBox', type: 'Checkbox' },
{ Id: 'Excel', type: 'Excel' }
];
public ddlfields: Object = { text: 'type', value: 'Id' };
public formatoptions: Object;
public numberFormat: string;
@ViewChild('grid')
public grid: GridComponent;
ngOnInit(): void {
loadCldr(calendar, timeZoneNames, weekData, numbers, numberingSystems, currencies);
setCulture('tr');
setCurrencyCode('TRY');
this.data = orderDataSource;
this.pageSettings = { pageCount: 5 };
this.filterSettings = { type: 'Menu' };
this.ddldata = this.filteringType;
this.formatoptions = { type: 'dateTime', format: 'M/d/y hh:mm a' }
}
public onChange(e: ChangeEventArgs): void {
this.grid.filterSettings.type = <FilterType>e.value;
this.grid.clearFiltering();
}
} |
npm install cldr-data
|