Simple table sort with three columns - keeping track of column and order
<p>I have three table headers, each with ID's: <strong>deadline_column</strong>, <strong>duration_column</strong>, and <strong>description_column</strong></p>

<p>Each <code>&lt;th&gt;</code> has an class of 'headerSort'. What I'm trying to do right now is, once one of the headings are clicked: determine the column clicked, and then alternate between ascending and descending. The main trouble I'm having is going back to the default sort (ascending) when a new column is clicked. Right now I have:</p>

<pre><code>$(document).ready(function(){

            var order;
            var column; 

            $('.headerSort').on('click', function(){
                var column = $(this).attr('id');
                if (order=='ascending'){
                    order = 'descending';
                } else {
                    order = 'ascending'; 
                }

                alert (order);
                // deadline_column
                // duration_column
                // description_column

                // switch(column){
                //  case 'deadline_column':
                //  break;

                //  case 'duration_column':
                //  break;

                //  case 'description_column':
                //  break;
                // }

            });
</code></pre>

<p>I can't think up a way to do this that won't come out being overly verbose. </p>
