loadCldr(currencies, cagregorian, numberLocale, timeZoneNames, numberingSystems);
setCulture('de');
setCurrencyCode('EUR');
@Component({
selector: 'my-app',
template: `<ejs-grid id='Grid' [dataSource]='data' [allowPaging]='true' [allowGrouping]='true' [locale]='de-DE' height='315px'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
<e-column field='Freight' headerText='Freight' [format]='formatOptions' textAlign='Right' width=150></e-column>
<e-column field='OrderDate' headerText='Order Date' type='date' format='yMd' width=150 ></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>`
})
export class AppComponent implements OnInit {
public data: Object[];
public formatOptions: Object;
ngOnInit(): void {
this.data = data;
this.formatOptions = { format:'N2' }
}
} |
<div class="control-section">
<ejs-grid [dataSource]='data' height='350'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' width='120' textAlign='Right'></e-column>
<e-column field='CustomerName' headerText='Customer Name' width='150'></e-column>
<e-column field='OrderDate' headerText='Order Date' width='130' [format]="{type: 'date', format:'dd/MM/yyyy hh:mm:ss a'}" textAlign='Right'></e-column>
<e-column field='Freight' headerText='Freight' width='120' format='C2' textAlign='Right'></e-column>
<e-column field='ShippedDate' headerText='Shipped Date' width='130' [format]="{type: 'dateTime', skeleton: 'short'}" textAlign='Right'></e-column>
<e-column field='ShipCountry' headerText='Ship Country' width='150'></e-column>
</e-columns>
</ejs-grid>
</div> |
...
@Component({
selector: 'control-content',
templateUrl: 'default.html'
})
export class DefaultComponent implements OnInit {
public data: Object[] = [];
@ViewChild('grid')
public grid: GridComponent;
ngOnInit(): void {
this.data = orderDatas;
}
public valueAccess = (field: string, data: Object, column: Object) => {
debugger
let intl: Internationalization = new Internationalization();
var val = intl.getDateFormat({ type: 'dateTime', format: 'dd-MM-yyyy hh:mm:ss'})(new Date);
var seperator = (getValue('main.es.dates.calendars.gregorian.dateFormats.short.1',cagregorian) || "");
return val.split('-').join(seperator);
}
} |