Skip to content Skip to sidebar Skip to footer

Jquery Table Sorting Not Working With Images

I have a table being echo'ed out by php,
Player Name Leve

Solution 1:

I have made a new version of the last question's answer that includes a solution for this new problem available at: https://jsfiddle.net/mdbdj895/1/

This causes the <td> elements that contain the pictures to get a sorttable_customkey attribute with appropriate value (based on the <td>'s id attribute), since the library you are using seems to need that attribute.

The result now is that, not only do images get created in the <td> elements that have a src that is based on the parent <td>'s id attribute, but that <td> itself gets the new attribute with correct value, like this:

<tr>
    <td>Krack</td>
    <td id="7" class="level" sorttable_customkey="7">
      <img src="../img/CL7.png" alt="7">
    </td>
</tr>

Solution 2:

I had a look at that library and it seems you have to use custom keys

It would be this way:

<td id="1" class="level" sorttable_customkey="1">1</td>
<td id="2" class="level" sorttable_customkey="2">2</td>
<td id="3" class="level" sorttable_customkey="3">3</td>
.................. And so on

Post a Comment for "Jquery Table Sorting Not Working With Images"