UNPKG

jqwidgets-framework

Version:

jQWidgets is an advanced Angular, Vue, Blazor, React, Web Components, jquery, ASP .NET MVC, Custom Elements and HTML5 UI framework.

55 lines (44 loc) 1.73 kB
import { Component, ViewChild, ViewEncapsulation } from '@angular/core'; import { jqxGridComponent } from 'jqwidgets-ng/jqxgrid'; import { jqxPanelComponent } from 'jqwidgets-ng/jqxpanel'; import { generatedata } from './../../../sampledata/generatedata'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'], encapsulation: ViewEncapsulation.None }) export class AppComponent { @ViewChild('myGrid', { static: false }) myGrid: jqxGridComponent; data: any = generatedata(500, false); source: any = { localdata: this.data, datafields: [ { name: 'firstname', type: 'string' }, { name: 'lastname', type: 'string' }, { name: 'productname', type: 'string' }, { name: 'date', type: 'date' }, { name: 'quantity', type: 'number' }, { name: 'price', type: 'number' } ], datatype: 'array' }; getWidth() : any { if (document.body.offsetWidth < 850) { return '90%'; } return 850; } dataAdapter: any = new jqx.dataAdapter(this.source); columns: any[] = [ { text: 'First Name', datafield: 'firstname', width: 160 }, { text: 'Last Name', datafield: 'lastname', width: 160 }, { text: 'Product', datafield: 'productname', width: 170 }, { text: 'Order Date', datafield: 'date', filtertype: 'date', width: 160, cellsformat: 'dd-MMMM-yyyy' }, { text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' }, { text: 'Unit Price', datafield: 'price', cellsalign: 'right', cellsformat: 'c2' } ]; }