taffy-coustom-ui
Version:
56 lines (44 loc) • 1.61 kB
text/typescript
import { Component, ViewChild } from '@angular/core';
import { jqxGridComponent } from 'jqwidgets-ng/jqxgrid';
import { generatedata } from './../../../sampledata/generatedata';
({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {
('myGrid', { static: false }) myGrid: jqxGridComponent;
data: any = generatedata(500, false);
getWidth() : any {
if (document.body.offsetWidth < 850) {
return '90%';
}
return 850;
}
source: any =
{
localdata: this.data,
datafields:
[
{ name: 'name', type: 'string' },
{ name: 'productname', type: 'string' },
{ name: 'available', type: 'bool' },
{ name: 'date', type: 'date' },
{ name: 'quantity', type: 'number' }
],
datatype: 'array'
};
dataAdapter: any = new jqx.dataAdapter(this.source);
columns: any[] =
[
{ text: 'Name', columntype: 'textbox', filtertype: 'input', datafield: 'name', width: 215 },
{ text: 'Product', filtertype: 'checkedlist', datafield: 'productname', width: 220 },
{ text: 'Available', datafield: 'available', columntype: 'checkbox', filtertype: 'bool', width: 67 },
{ text: 'Ship Date', datafield: 'date', filtertype: 'range', width: 210, cellsalign: 'right', cellsformat: 'd' },
{ text: 'Qty.', datafield: 'quantity', filtertype: 'number', cellsalign: 'right' }
];
clearFiltering(): void {
if (this.myGrid) {
this.myGrid.clearfilters();
}
}
}