title: jQuery/Javascript - Sort Table Columns Based on Totals Row
body: <p>How can a sort be performed on table columns based on the sort of the last totals row?</p>
  
  <p>For example, with the following table structure the row titled "Total Sold %" would be used to sort the corresponding columns in value from high to low. Thus, the columns would shift left or right so that the "Total Sold %" row is sorted <strong>12.42%, 12.64%, 14.73%</strong>:</p>
  
  <pre><code>&lt;table class="table table-bordered text-center"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th class="text-center"&gt;
          Average
        &lt;/th&gt;
        &lt;th class="text-center"&gt;
          Entry #1
        &lt;/th&gt;
        &lt;th class="text-center"&gt;
          Entry #2
        &lt;/th&gt;
        &lt;th class="text-center"&gt;
          Entry #3
        &lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;th scope="row"&gt;
          New Car Total Leads
        &lt;/th&gt;
        &lt;td&gt;
          251
        &lt;/td&gt;
        &lt;td&gt;
          227
        &lt;/td&gt;
        &lt;td&gt;
          526
        &lt;/td&gt;
      &lt;tr&gt;
        &lt;th scope="row"&gt;
          Appointments Shown %
        &lt;/th&gt;
        &lt;td&gt;
          61%
        &lt;/td&gt;
        &lt;td&gt;
          61%
        &lt;/td&gt;
        &lt;td&gt;
          61%
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;th scope="row"&gt;
          Sold (Delivered)
        &lt;/th&gt;
        &lt;td&gt;
          28
        &lt;/td&gt;
        &lt;td&gt;
          37
        &lt;/td&gt;
        &lt;td&gt;
          85
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;th scope="row"&gt;
          Total Sold %
        &lt;/th&gt;
        &lt;td&gt;
          12.64%
        &lt;/td&gt;
        &lt;td&gt;
          12.42%
        &lt;/td&gt;
        &lt;td&gt;
          14.73%
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>