File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed
2-ui/2-events/03-event-delegation/3-sortable-table Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 2525 < table id ="grid ">
2626 < thead >
2727 < tr >
28- < th data-type ="number "> Age </ th >
28+ < th data-type ="number "> 나이 </ th >
2929 < th data-type ="string "> 이름</ th >
3030 </ tr >
3131 </ thead >
4040 </ tr >
4141 < tr >
4242 < td > 12</ td >
43- < td > 한솔 </ td >
43+ < td > 호진 </ td >
4444 </ tr >
4545 < tr >
4646 < td > 9</ td >
47- < td > Eugene </ td >
47+ < td > 지민 </ td >
4848 </ tr >
4949 < tr >
5050 < td > 1</ td >
51- < td > Ilya </ td >
51+ < td > 재인 </ td >
5252 </ tr >
5353 </ tbody >
5454 </ table >
5959 if ( e . target . tagName != 'TH' ) return ;
6060
6161 let th = e . target ;
62- // if TH, then sort
62+ // 클릭한 요소가 TH라면 정렬을 진행합니다.
6363 // cellIndex는 몇 번째 열인지를 나타내는 인덱스 값입니다.
64- // 0 for the first column
64+ // 첫 번째 열이라면 0,
6565 // 두 번째 열이라면 1이 됩니다.
6666 sortGrid ( th . cellIndex , th . dataset . type ) ;
6767 } ;
8787 break ;
8888 }
8989
90- // sort
90+ // 해당 열을 정렬합니다.
9191 rowsArray . sort ( compare ) ;
9292
9393 tbody . append ( ...rowsArray ) ;
Original file line number Diff line number Diff line change 2626 < thead >
2727 < tr >
2828 < th data-type ="number "> 나이</ th >
29- < th data-type ="string "> Name </ th >
29+ < th data-type ="string "> 이름 </ th >
3030 </ tr >
3131 </ thead >
3232 < tbody >
3636 </ tr >
3737 < tr >
3838 < td > 2</ td >
39- < td > Pete </ td >
39+ < td > 보라 </ td >
4040 </ tr >
4141 < tr >
4242 < td > 12</ td >
4343 < td > 호진</ td >
4444 </ tr >
4545 < tr >
4646 < td > 9</ td >
47- < td > Eugene </ td >
47+ < td > 민지 </ td >
4848 </ tr >
4949 < tr >
5050 < td > 1</ td >
Original file line number Diff line number Diff line change @@ -40,4 +40,4 @@ importance: 4
4040
4141[ iframe border=1 src="solution" height=190]
4242
43- P.S. The table can be big, with any number of rows and columns .
43+ P.S. 표 크기는 예시보다 훨씬 클 수 있습니다. 열이나 행이 더 추가될 수 있다는 가정하에 답을 작성해보세요 .
You can’t perform that action at this time.
0 commit comments