HtmlTable (sortable) - Mixed column requires multiple clicks to sort #1039

Open
ghost opened this Issue Sep 27, 2011 · 0 comments

0 participants

@ghost

Maybe I'm not understanding the documentation correctly, but when I create an HtmlTable and make it sortable, mixed columns do not sort correctly. I have included an example below to try. If you click the first column, it takes two clicks to make it sort with mixed content (alpha and numbers). If you click the second column, it only takes one because it's the same data type. Same goes for the third. I added a TH background color change as a visual queue on when the sort takes place. It would be great if I'm just missing something. I have confirmed this on 1.3 as well.

Example code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sort Test</title>
<style type="text/css">
th {
    cursor: pointer;
}
.table-th-sort-rev {
    background-color: #CCC; 
}
</style>
<script type="text/javascript" src="mootools-core-1.4.0.js"></script>
<script type="text/javascript" src="mootools-more-1.4.0.js"></script>
<script type="text/javascript">
<!--
window.addEvent('domready', function(){

    new HtmlTable($('test'), {
        sortable: true
    });

});
-->
</script>
</head>

<body>

<table id="test" border="1">
  <thead>
    <tr>
      <th>Mixed</th>
      <th>Numeric</th>
      <th>Alpha</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>1234</td>
      <td>12345</td>
      <td>Text here</td>
    </tr>
    <tr>
      <td>asdfasdghg</td>
      <td>4444444</td>
      <td>more text</td>
    </tr>
    <tr>
      <td>Lorem Ipsum</td>
      <td>00000</td>
      <td>isn't this fun?</td>
    </tr>
  </tbody>
</table>

</body>
</html>

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment