File tree Expand file tree Collapse file tree
2-ui/2-events/03-event-delegation/3-sortable-table Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,42 +2,42 @@ importance: 4
22
33---
44
5- # Sortable table
5+ # جدول قابل للفرز
66
7- Make the table sortable: clicks on ` <th> ` elements should sort it by corresponding column .
7+ اجعل الجدول قابلًا للفرز: يجب أن تقوم النقرات على عناصر ` <th> ` بفرزه حسب العمود المقابل .
88
9- Each ` <th> ` has the type in the attribute, like this :
9+ كل ` <th> ` لديه النوع في السمة ، مثل هذا :
1010
1111``` html
1212<table id =" grid" >
1313 <thead >
1414 <tr >
1515*!*
16- <th data-type =" number" >Age </th >
17- <th data-type =" string" >Name </th >
16+ <th data-type =" number" >العمر </th >
17+ <th data-type =" string" >الاسم </th >
1818*/!*
1919 </tr >
2020 </thead >
2121 <tbody >
2222 <tr >
2323 <td >5</td >
24- <td >John </td >
24+ <td >جون </td >
2525 </tr >
2626 <tr >
2727 <td >10</td >
28- <td >Ann </td >
28+ <td >آن </td >
2929 </tr >
3030 ...
3131 </tbody >
3232</table >
3333```
3434
35- In the example above the first column has numbers, and the second one -- strings. The sorting function should handle sort according to the type .
35+ في المثال أعلاه ، يحتوي العمود الأول على أرقام ، والثاني - على سلاسل. يجب أن تتعامل وظيفة الفرز مع الترتيب وفقًا للنوع .
3636
37- Only ` "string" ` and ` "number" ` types should be supported .
37+ يجب دعم أنواع ` "string" ` و ` "number" ` فقط .
3838
39- The working example :
39+ المثال العامل :
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+ ملاحظة: يمكن أن يكون الجدول كبيرًا ، بأي عدد من الصفوف والأعمدة .
You can’t perform that action at this time.
0 commit comments