title: Sorting a column ascending and descending by clicking on the column's header using javascript
body: <p>I need help to create a javascript function that allow me to sort a column (table) by clicking on the column header. The column contains 8 digit number and several rows. I need to sort it ascending and then descending with a verification to make sure the sort did work and also log the sort for each.</p>
  <p>I am using TestComplete with javascript scripting.</p>
  <p><strong>Example of verification:</strong></p>
  <p>//Verify the sort functionality</p>
  <pre><code>       for (var k = 0; i &lt; records.length; k++)
          {
          if(column[k] != column_sorted[k])
          Log.Warning(&quot;Sort functionality does not work for the column&quot;)
     
          break;
         }
         Log.Checkpoint(&quot;Sort functionality works for the column&quot;)
           Log.Message(column_sorted[k].contentText);
  </code></pre>
  <p>Thanks for your help!</p>