[ Web Proxy ]
URL:
Viewing: https://da.javascript.info/task/sortable-table [Back]  [Original]

Sortable table
DA

Vi nsker at gre dette open source-projekt tilgngeligt for folk over hele verden.

Hjlp med at overstte indholdet af denne tutorial til dit sprog!

    Sg p Javascript.info:
    Sg i tutorialen:
    Lyst temaMrkt tema
    DanskEnglishEspaolFranaisIndonesiaItalianoTrkeOzbek
    tilbage til lektionen
    Dette materiale er kun tilgngeligt p flgende sprog: , English, Espaol, Franais, Indonesia, Italiano, , , , , Ozbek, . Hjlp os med at overstte til Dansk.

    Sortable table

    vigtighed: 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.

    bn en sandbox til opgaven.

    lsning

    Web Proxy Viewer  |  New URL  |  Original Page