Javascript reverse sorting
<p>i have a problem on javascript reverse method when all the data to be sorted are equal.</p>

<p>here is my code:</p>

<pre><code>var ascAgt = false;
        function sortTableAgt() {
            var tbl = document.getElementById("mytable").tBodies[0];
            var store = [];
            for (var i = 0, len = tbl.rows.length; i &lt; len; i++) {
                var row = tbl.rows[i];
                var rowdatedata = row.cells[1].innerHTML;
                store.push([rowdatedata, row]);
            }
            if (ascAgt) {
                store.sort();
                ascAgt = false;
            } else {
                store.sort();
                store.reverse();
                ascAgt = true;
            }
            for (var i = 0, len = store.length; i &lt; len; i++) {
                var idno = i + 1;
                store[i][1].cells[0].innerHTML = idno.toString();
                tbl.appendChild(store[i][1]);
            } store = null;
        }
</code></pre>

<p>sample data:</p>

<pre><code>ID  Name    Date
1   XXXXX   2012/10/05
2   XXXXX   2012/03/16
3   XXXXX   2012/05/18
4   XXXXX   2012/05/18
</code></pre>

<p>as i sort the name part,what i want is that nothing happens because names are equal but when it comes to the reverse method it will just reversed the given data.
am i missing something here?
thank you in advance....</p>
