• ARعربي
  • ENEnglish
  • ESEspañol
  • FAفارسی
  • FRFrançais
  • IDIndonesia
  • ITItaliano
  • JA日本語
  • KO한국어
  • RUРусский
  • TRTürkçe
  • UKУкраїнська
  • ZH简体中文

ما قصد داریم این پروژهٔ متن‌باز را در دسترس همهٔ مردم در سرتاسر دنیا قرار دهیم.

به ترجمهٔ محتوای این آموزش به زبان خودتان کمک کنید/a>.

    نقشه آموزش
    اشتراک گذاری
    • آموزش
    • مرورگر: Document، Eventها، رابط‌ها
    • معرفی Events
    • پترن Event delegation
    بازگشت به درس
    این محتوا تنها در این زبان‌ها موجود است: عربي, English, Español, Français, Indonesia, Italiano, 日本語, 한국어, Русский, Українська, 简体中文. لطفاً به ما

    Sortable table

    اهمیت: 4

    Make the table sortable: clicks on <th> elements should sort it by corresponding column.

    Each <th> has the type in the attribute, like this:

    <table id="grid">
      <thead>
        <tr>
          <th data-type="number">Age</th>
          <th data-type="string">Name</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>5</td>
          <td>John</td>
        </tr>
        <tr>
          <td>10</td>
          <td>Ann</td>
        </tr>
        ...
      </tbody>
    </table>

    In the example above the first column has numbers, and the second one – strings. The sorting function should handle sort according to the type.

    Only "string" and "number" types should be supported.

    The working example:

    P.S. The table can be big, with any number of rows and columns.

    باز کردن یک sandbox برای تمرین.

    باز کردن راه‌حل درون sandbox.

    • © 2007—2025  Ilya Kantor
    • دربارهٔ پروژه
    • تماس با ما