File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed
Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -122,8 +122,38 @@ function Table() {
122122
123123 // Handle Search is the same as Handle Filter
124124 const handleSearch = ( e : React . ChangeEvent < HTMLInputElement > ) => {
125+ let searchValue : Boolean ;
126+ let personIDValue : Boolean ;
127+ let fullNameValue : Boolean ;
128+ let heightValue : Boolean ;
129+ let eyeColorValue : Boolean ;
130+
125131 const newRows = rows . filter ( ( row ) => {
126- return row . fullName . toLowerCase ( ) . includes ( e . target . value . toLowerCase ( ) ) ;
132+ personIDValue = row . personID
133+ . toString ( )
134+ . toLowerCase ( )
135+ . includes ( e . target . value . toLowerCase ( ) ) ;
136+ fullNameValue = row . fullName
137+ . toLowerCase ( )
138+ . includes ( e . target . value . toLowerCase ( ) ) ;
139+ heightValue = row . height
140+ . toLowerCase ( )
141+ . includes ( e . target . value . toLowerCase ( ) ) ;
142+ eyeColorValue = row . eyeColor
143+ . toLowerCase ( )
144+ . includes ( e . target . value . toLowerCase ( ) ) ;
145+
146+ if ( personIDValue ) {
147+ searchValue = personIDValue ;
148+ } else if ( fullNameValue ) {
149+ searchValue = fullNameValue ;
150+ } else if ( heightValue ) {
151+ searchValue = heightValue ;
152+ } else {
153+ searchValue = eyeColorValue ;
154+ }
155+
156+ return searchValue ;
127157 } ) ;
128158
129159 setData ( newRows ) ;
You can’t perform that action at this time.
0 commit comments