|
1 | | -import { Component, ViewChild, ViewEncapsulation, OnInit } from '@angular/core'; |
2 | | -import { IgxColumnComponent, IgxGridComponent, IgxCellHeaderTemplateDirective, IgxIconComponent } from 'igniteui-angular'; |
3 | | -import { DATA } from '../../data/customers'; |
4 | | -import { IgxPreventDocumentScrollDirective } from '../../directives/prevent-scroll.directive'; |
5 | | - |
| 1 | +import { Component, ViewChild, OnInit, inject } from "@angular/core"; |
| 2 | +import { |
| 3 | + IgxColumnComponent, |
| 4 | + IgxGridComponent, |
| 5 | + IgxCellHeaderTemplateDirective, |
| 6 | + IgxIconComponent, |
| 7 | + IgxIconService |
| 8 | +} from "igniteui-angular"; |
| 9 | +import { DATA } from "../../data/customers"; |
| 10 | +import { IgxPreventDocumentScrollDirective } from "../../directives/prevent-scroll.directive"; |
6 | 11 |
|
7 | 12 | @Component({ |
8 | | - selector: 'app-grid-sample', |
9 | | - styleUrls: ['grid-pinning-styling.component.scss'], |
10 | | - templateUrl: 'grid-pinning-styling.component.html', |
11 | | - imports: [IgxGridComponent, IgxPreventDocumentScrollDirective, IgxColumnComponent, IgxCellHeaderTemplateDirective, IgxIconComponent] |
| 13 | + selector: "app-grid-sample", |
| 14 | + styleUrls: ["grid-pinning-styling.component.scss"], |
| 15 | + templateUrl: "grid-pinning-styling.component.html", |
| 16 | + imports: [ |
| 17 | + IgxGridComponent, |
| 18 | + IgxPreventDocumentScrollDirective, |
| 19 | + IgxColumnComponent, |
| 20 | + IgxCellHeaderTemplateDirective, |
| 21 | + IgxIconComponent |
| 22 | + ] |
12 | 23 | }) |
| 24 | +export class PinningStylingComponent implements OnInit { |
| 25 | + private iconService = inject(IgxIconService); |
| 26 | + @ViewChild("grid1", { static: true }) public grid1: IgxGridComponent; |
13 | 27 |
|
14 | | -export class PinningStylingComponent implements OnInit{ |
15 | | - @ViewChild('grid1', { static: true }) public grid1: IgxGridComponent; |
| 28 | + constructor() { |
| 29 | + this.iconService.setFamily("fas", { |
| 30 | + className: "fas", |
| 31 | + type: "font", |
| 32 | + prefix: "fa-" |
| 33 | + }); |
| 34 | + } |
16 | 35 |
|
17 | 36 | public data: any[]; |
18 | 37 | public columns: any[]; |
19 | 38 | public ngOnInit(): void { |
20 | 39 | this.columns = [ |
21 | | - { field: 'ID', header: 'ID', width: 100, hidden: true }, |
22 | | - { field: 'CompanyName', header: 'Company Name', width: 300 }, |
23 | | - { field: 'ContactName', header: 'Contact Name', width: 200, pinned: true }, |
24 | | - { field: 'ContactTitle', header: 'Contact Title', width: 200, pinned: true }, |
25 | | - { field: 'Address', header: 'Address', width: 300 }, |
26 | | - { field: 'City', header: 'City', width: 120 }, |
27 | | - { field: 'Region', header: 'Region', width: 120 }, |
28 | | - { field: 'PostalCode', header: 'Postal Code', width: 150 }, |
29 | | - { field: 'Phone', header: 'Phone', width: 150 }, |
30 | | - { field: 'Fax', header: 'Fax', width: 150 } |
| 40 | + { field: "ID", header: "ID", width: 100, hidden: true }, |
| 41 | + { field: "CompanyName", header: "Company Name", width: 300 }, |
| 42 | + { |
| 43 | + field: "ContactName", |
| 44 | + header: "Contact Name", |
| 45 | + width: 200, |
| 46 | + pinned: true |
| 47 | + }, |
| 48 | + { |
| 49 | + field: "ContactTitle", |
| 50 | + header: "Contact Title", |
| 51 | + width: 200, |
| 52 | + pinned: true |
| 53 | + }, |
| 54 | + { field: "Address", header: "Address", width: 300 }, |
| 55 | + { field: "City", header: "City", width: 120 }, |
| 56 | + { field: "Region", header: "Region", width: 120 }, |
| 57 | + { field: "PostalCode", header: "Postal Code", width: 150 }, |
| 58 | + { field: "Phone", header: "Phone", width: 150 }, |
| 59 | + { field: "Fax", header: "Fax", width: 150 } |
31 | 60 | ]; |
32 | 61 | this.data = DATA; |
33 | 62 | } |
|
0 commit comments