@@ -10,7 +10,7 @@ import { NwindDataItem, NwindDataItem_LocationsItem, NwindData } from './NwindDa
1010
1111import 'igniteui-react-grids/grids/combined' ;
1212import 'igniteui-react-grids/grids/themes/light/bootstrap.css' ;
13- import { IgrButtonGroup , IgrComponentValueChangedEventArgs , IgrIcon , IgrIconMeta , IgrToggleButton } from 'igniteui-react' ;
13+ import { IgrButtonGroup , IgrComponentValueChangedEventArgs , IgrIcon , IgrIconMeta , IgrToggleButton , setIconRef , registerIconFromText } from 'igniteui-react' ;
1414import { arrowDown , arrowUp , caretDown , chevronRight , ellipsisRight , eye , eyeSlash , fileExport , filter , magnifyGlass , thumbtack , thumbtackSlash , xMark } from './icons' ;
1515
1616const mods : any [ ] = [
@@ -25,132 +25,113 @@ export default class Sample extends React.Component<any, any> {
2525 this . grid = r ;
2626 this . setState ( { } ) ;
2727 }
28- public iconRef ( icon : IgrIcon ) {
29- if ( ! icon ) {
30- return ;
31- }
32- // register icons
33- this . iconInstance = icon ;
34- this . iconInstance . registerIconFromText ( "filter_list" , filter , "fontAwesome" ) ;
35- this . iconInstance . registerIconFromText ( "arrow_upward" , arrowUp , "fontAwesome" ) ;
36- this . iconInstance . registerIconFromText ( "arrow_downward" , arrowDown , "fontAwesome" ) ;
37- this . iconInstance . registerIconFromText ( "more_vert" , ellipsisRight , "fontAwesome" ) ;
38- this . iconInstance . registerIconFromText ( "unpin-left" , thumbtackSlash , "fontAwesome" ) ;
39- this . iconInstance . registerIconFromText ( "pin-left" , thumbtack , "fontAwesome" ) ;
40- this . iconInstance . registerIconFromText ( "visibility" , eye , "fontAwesome" ) ;
41- this . iconInstance . registerIconFromText ( "visibility_off" , eyeSlash , "fontAwesome" ) ;
42- this . iconInstance . registerIconFromText ( "search" , magnifyGlass , "fontAwesome" ) ;
43- this . iconInstance . registerIconFromText ( "chevron_right" , chevronRight , "fontAwesome" ) ;
44- this . iconInstance . registerIconFromText ( "clear" , xMark , "fontAwesome" ) ;
45- this . iconInstance . registerIconFromText ( "file_download" , fileExport , "fontAwesome" ) ;
46- this . iconInstance . registerIconFromText ( "arrow_drop_down" , caretDown , "fontAwesome" ) ;
47- }
48- private _pinningConfig1 : IgrPinningConfig | null = null ;
49- public get pinningConfig1 ( ) : IgrPinningConfig {
50- if ( this . _pinningConfig1 == null ) {
51- var pinningConfig1 : IgrPinningConfig = { } as IgrPinningConfig ;
52- pinningConfig1 . rows = RowPinningPosition . Top ;
53-
54- this . _pinningConfig1 = pinningConfig1 ;
55- }
56- return this . _pinningConfig1 ;
57- }
5828
5929 public onSelect ( _buttonGroup : IgrButtonGroup , args : IgrComponentValueChangedEventArgs ) {
6030 this . changeRefs ( args . detail ) ;
6131 }
6232
6333 private changeRefs ( collectionName : string ) {
64- this . iconInstance . setIconRef ( 'arrow_drop_down' , 'default' , {
34+ setIconRef ( 'arrow_drop_down' , 'default' , {
6535 name : 'arrow_drop_down' ,
6636 collection : collectionName ,
67- } as IgrIconMeta ) ;
68- this . iconInstance . setIconRef ( 'file_download' , 'default' , {
37+ } ) ;
38+ setIconRef ( 'file_download' , 'default' , {
6939 name : 'file_download' ,
7040 collection : collectionName ,
71- } as IgrIconMeta ) ;
72- this . iconInstance . setIconRef ( 'clear' , 'default' , {
41+ } ) ;
42+ setIconRef ( 'clear' , 'default' , {
7343 name : 'clear' ,
7444 collection : collectionName ,
75- } as IgrIconMeta ) ;
76- this . iconInstance . setIconRef ( 'chevron_right' , 'default' , {
45+ } ) ;
46+ setIconRef ( 'chevron_right' , 'default' , {
7747 name : 'chevron_right' ,
7848 collection : collectionName ,
79- } as IgrIconMeta ) ;
49+ } ) ;
8050
81- this . iconInstance . setIconRef ( 'search' , 'default' , {
51+ setIconRef ( 'search' , 'default' , {
8252 name : 'search' ,
8353 collection : collectionName ,
84- } as IgrIconMeta ) ;
54+ } ) ;
8555
86- this . iconInstance . setIconRef ( 'hide' , 'default' , {
56+ setIconRef ( 'hide' , 'default' , {
8757 name : 'visibility_off' ,
8858 collection : collectionName ,
89- } as IgrIconMeta ) ;
59+ } ) ;
9060
91- this . iconInstance . setIconRef ( 'show' , 'default' , {
61+ setIconRef ( 'show' , 'default' , {
9262 name : 'visibility' ,
9363 collection : collectionName ,
94- } as IgrIconMeta ) ;
64+ } ) ;
9565
96- this . iconInstance . setIconRef ( 'unpin' , 'default' , {
66+ setIconRef ( 'unpin' , 'default' , {
9767 name : 'unpin-left' ,
9868 collection : collectionName === "material" ? "imx-icons" : collectionName ,
99- } as IgrIconMeta ) ;
69+ } ) ;
10070
101- this . iconInstance . setIconRef ( 'pin' , 'default' , {
71+ setIconRef ( 'pin' , 'default' , {
10272 name : 'pin-left' ,
10373 collection : collectionName === "material" ? "imx-icons" : collectionName ,
104- } as IgrIconMeta ) ;
105- this . iconInstance . setIconRef ( 'filter_list' , 'default' , {
74+ } ) ;
75+ setIconRef ( 'filter_list' , 'default' , {
10676 name : 'filter_list' ,
10777 collection : collectionName ,
108- } as IgrIconMeta ) ;
78+ } ) ;
10979
110- this . iconInstance . setIconRef ( 'sort_asc' , 'default' , {
80+ setIconRef ( 'sort_asc' , 'default' , {
11181 name : 'arrow_upward' ,
11282 collection : collectionName ,
113- } as IgrIconMeta ) ;
83+ } ) ;
11484
115- this . iconInstance . setIconRef ( 'more_vert' , 'default' , {
85+ setIconRef ( 'more_vert' , 'default' , {
11686 name : 'more_vert' ,
11787 collection : collectionName ,
118- } as IgrIconMeta ) ;
88+ } ) ;
11989
120- this . iconInstance . setIconRef ( 'sort_desc' , 'default' , {
90+ setIconRef ( 'sort_desc' , 'default' , {
12191 name : 'arrow_downward' ,
12292 collection : collectionName ,
123- } as IgrIconMeta ) ;
124- }
93+ } ) ;
94+ }
12595
12696 constructor ( props : any ) {
12797 super ( props ) ;
12898
12999 this . gridRef = this . gridRef . bind ( this ) ;
130- this . iconRef = this . iconRef . bind ( this ) ;
131100 this . onSelect = this . onSelect . bind ( this ) ;
101+
102+ registerIconFromText ( "filter_list" , filter , "fontAwesome" ) ;
103+ registerIconFromText ( "arrow_upward" , arrowUp , "fontAwesome" ) ;
104+ registerIconFromText ( "arrow_downward" , arrowDown , "fontAwesome" ) ;
105+ registerIconFromText ( "more_vert" , ellipsisRight , "fontAwesome" ) ;
106+ registerIconFromText ( "unpin-left" , thumbtackSlash , "fontAwesome" ) ;
107+ registerIconFromText ( "pin-left" , thumbtack , "fontAwesome" ) ;
108+ registerIconFromText ( "visibility" , eye , "fontAwesome" ) ;
109+ registerIconFromText ( "visibility_off" , eyeSlash , "fontAwesome" ) ;
110+ registerIconFromText ( "search" , magnifyGlass , "fontAwesome" ) ;
111+ registerIconFromText ( "chevron_right" , chevronRight , "fontAwesome" ) ;
112+ registerIconFromText ( "clear" , xMark , "fontAwesome" ) ;
113+ registerIconFromText ( "file_download" , fileExport , "fontAwesome" ) ;
114+ registerIconFromText ( "arrow_drop_down" , caretDown , "fontAwesome" ) ;
132115 }
133116
134117 public render ( ) : JSX . Element {
135118 return (
136119 < div className = "container sample ig-typography" >
137- < IgrButtonGroup select = { this . onSelect } style = { { width : 'fit-content' } } >
138- < IgrToggleButton value = "material" key = "material" selected >
139- < span key = "text" > Material Icons</ span >
140- </ IgrToggleButton >
141- < IgrToggleButton value = "fontAwesome" key = "awesome" >
142- < span key = "text" > Font Awesome Icons</ span >
143- </ IgrToggleButton >
144- </ IgrButtonGroup >
145- < IgrIcon ref = { this . iconRef } > </ IgrIcon >
120+ < IgrButtonGroup select = { this . onSelect } style = { { width : 'fit-content' } } >
121+ < IgrToggleButton value = "material" key = "material" selected >
122+ < span key = "text" > Material Icons</ span >
123+ </ IgrToggleButton >
124+ < IgrToggleButton value = "fontAwesome" key = "awesome" >
125+ < span key = "text" > Font Awesome Icons</ span >
126+ </ IgrToggleButton >
127+ </ IgrButtonGroup >
146128 < div className = "container fill" >
147129 < IgrGrid
148130 autoGenerate = "false"
149131 ref = { this . gridRef }
150132 data = { this . nwindData }
151133 rowEditable = "true"
152134 allowFiltering = "true"
153- pinning = { this . pinningConfig1 }
154135 filterMode = "ExcelStyleFilter"
155136 primaryKey = "ProductID" >
156137 < IgrGridToolbar >
@@ -164,7 +145,7 @@ export default class Sample extends React.Component<any, any> {
164145 < IgrColumn
165146 name = "ProductName"
166147 field = "ProductName"
167- header = "Product Name" sortable = "true" >
148+ header = "Product Name" sortable = "true" >
168149 </ IgrColumn >
169150 < IgrColumn
170151 name = "UnitPrice"
0 commit comments