jqwidgets-framework
Version:
jQWidgets is an advanced Angular, Vue, Blazor, React, Web Components, jquery, ASP .NET MVC, Custom Elements and HTML5 UI framework.
53 lines (44 loc) • 1.93 kB
text/typescript
import { Component, ViewChild } from '@angular/core';
import { jqxGridComponent } from 'jqwidgets-ng/jqxgrid'
({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {
('myGrid', { static: false }) myGrid: jqxGridComponent;
source: any =
{
datatype: 'xml',
datafields: [
{ name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' },
{ name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' },
{ name: 'ShipName', map: 'm\\:properties>d\\:ShipName', type: 'string' },
{ name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress', type: 'string' },
{ name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity', type: 'string' },
{ name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry', type: 'string' }
],
root: 'entry',
record: 'content',
id: 'm\\:properties>d\\:OrderID',
url: './../../../sampledata/orders.xml'
};
getWidth() : any {
if (document.body.offsetWidth < 850) {
return '90%';
}
return 850;
}
dataAdapter: any = new jqx.dataAdapter(this.source);
columns: any[] =
[
{ text: 'Ship Name', datafield: 'ShipName', width: 250, align: 'left', cellsalign: 'left' },
{ text: 'Freight', datafield: 'Freight', width: 80, align: 'right', cellsformat: 'F2', cellsalign: 'right' },
{ text: 'Ship Address', datafield: 'ShipAddress', align: 'left', width: 350, cellsalign: 'left' },
{ text: 'Ship City', datafield: 'ShipCity', width: 100, align: 'left', cellsalign: 'left' },
{ text: 'Ship Country', datafield: 'ShipCountry', align: 'left', cellsalign: 'left' }
];
ready = (): void => {
this.myGrid.selectcell(0, 'ShipName');
this.myGrid.focus();
}
}