@@ -22,6 +22,8 @@ import {
2222const mods : any [ ] = [ IgrTreeGridModule , IgrChipModule , IgrIconButtonModule , IgrInputModule ] ;
2323mods . forEach ( ( m ) => m . register ( ) ) ;
2424
25+ const searchIconText =
26+ "<svg width='24' height='24' viewBox='0 0 24 24'><path d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z' /></svg>" ;
2527const prevIconText =
2628 "<svg width='24' height='24' viewBox='0 0 24 24'><path d='M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z'></path></svg>" ;
2729const nextIconText =
@@ -33,6 +35,7 @@ const data = new EmployeesFlatData();
3335
3436export default function Sample ( ) {
3537 const gridRef = useRef < IgrTreeGrid > ( null ) ;
38+ const searchIconRef = useRef < IgrIconButton > ( null ) ;
3639 const clearIconRef = useRef < IgrIconButton > ( null ) ;
3740 const iconButtonNextRef = useRef < IgrIconButton > ( null ) ;
3841 const iconButtonPrevRef = useRef < IgrIconButton > ( null ) ;
@@ -42,8 +45,9 @@ export default function Sample() {
4245 const [ searchText , setSearchText ] = useState ( '' )
4346
4447 useEffect ( ( ) => {
45- if ( clearIconRef ?. current ) {
46- clearIconRef . current . registerIconFromText ( "clear" , clearIconText , "material" ) ;
48+ if ( searchIconRef ?. current ) {
49+ searchIconRef . current . registerIconFromText ( "search" , searchIconText , "material" ) ;
50+ searchIconRef . current . registerIconFromText ( "clear" , clearIconText , "material" ) ;
4751 }
4852 if ( iconButtonPrevRef ?. current ) {
4953 iconButtonPrevRef . current . registerIconFromText ( "prev" , prevIconText , "material" ) ;
@@ -96,15 +100,26 @@ export default function Sample() {
96100 < IgrInput name = "searchBox" value = { searchText } inputOcurred = { handleOnSearchChange } >
97101
98102 < div slot = "prefix" key = "prefix" >
99- < IgrIconButton
100- key = "clearIcon"
101- ref = { clearIconRef }
102- variant = "flat"
103- name = "clear"
104- collection = "material"
105- clicked = { clearSearch }
106- > </ IgrIconButton >
103+ { searchText . length === 0 ? (
104+ < IgrIconButton
105+ key = "searchIcon"
106+ ref = { searchIconRef }
107+ variant = "flat"
108+ name = "search"
109+ collection = "material"
110+ > </ IgrIconButton >
111+ ) : (
112+ < IgrIconButton
113+ key = "clearIcon"
114+ ref = { clearIconRef }
115+ variant = "flat"
116+ name = "clear"
117+ collection = "material"
118+ clicked = { clearSearch }
119+ > </ IgrIconButton >
120+ ) }
107121 </ div >
122+
108123 < div slot = "suffix" key = "chipSuffix" >
109124 < IgrChip ref = { caseSensitiveChipRef } key = "caseSensitiveChip" selectable = "true" select = { handleCaseSensitiveChange } >
110125 < span key = "caseSensitive" > Case Sensitive</ span >
@@ -134,7 +149,7 @@ export default function Sample() {
134149 </ IgrInput >
135150 </ div >
136151 < IgrTreeGrid ref = { gridRef } data = { data } autoGenerate = "false"
137- primaryKey = "ID" foreignKey = "ParentID" allowFiltering = "true" height = "480px "
152+ primaryKey = "ID" foreignKey = "ParentID" allowFiltering = "true" height = "100%" width = "100% "
138153 >
139154 < IgrColumn field = "Name" dataType = "string" sortable = "true" > </ IgrColumn >
140155 < IgrColumn field = "ID" dataType = "number" sortable = "true" > </ IgrColumn >
0 commit comments