Can I adjust this code which displays a table to run faster? this.displayData = function () {
    var i;
    var $thead = $(thead);
    var $tbody = $(tbody);
    var numberOfFields = columnDataFields.length;
    var numberOfRows = data.length;

    // Variables to keep track of even and odd rows.
    var evenRowClass = 'EvenBar';
    var oddRowClass = 'OddBar';
    var t = false;

    $tbody.html('');

    // Find the widths of the column headers and apply the same widths here.
    // However, only do this if the colWidths are thus far undefined.
    if (!colWidths) {
        colWidths = [];
        var headers = $thead.find('td');
        var colWdith;
        for (i = 0; i &lt; headers.length; i++) {
            colwidth = $(headers[i]).outerWidth();
            colWidths.push(colwidth);
            $(headers[i]).css('width', colwidth); // This statement is necessary for cross-browser compatibility. (The problem is with discrepencies in "computed" CSS.)
        }
    }
    for (x in data) {
        var entry = data[x];
        var row = ['&lt;tr class="'];
        row.push(t ? evenRowClass : oddRowClass);
        row.push('"&gt;');
        for (i = 0; i &lt; numberOfFields; i++) {
            row.push('&lt;td style="width:');
            row.push(colWidths[i]);
            row.push(';"&gt;');
            row.push(entry[columnDataFields[i]]);
            row.push('&lt;/td&gt;');
        }
        row.push('&lt;/tr&gt;');

        $tbody.append(row.join(''));
        t = !t;
    }

    // If a callback function was set, invoke it.            
    if (typeof displayCallback === 'function')
        displayCallback();
} // end displayData
You don't need to redraw the entire table. Try just doing DOM manipulation to reorder the TRs.  I see that you also want to stripe the rows, but you can still do it with DOM manipulation. You should be able to take it from there.

I created a simple example with almost 1000 rows and it runs almost instantaneously. There's some jQuery just so I don't have to worry about cross-browser issues. If you don't use jQuery, most libraries have the functionality I used,or you can just implement $.text on your own http://jsfiddle.net/unffs/2

var table = document.getElementById('tbl');
// Can't call sort on an HTML collection, so copy the contents to an array
var rows = Array.prototype.slice.call(table.rows);
rows.sort(function(a, b) {
    var aVal = $(a).text(), bVal = $(b).text(); 
    return aVal &gt; bVal ? 1 : (bVal &gt; aVal ? -1 : 0);
});
var tbody = document.getElementById('tbody');
for (var i=0; i &lt; rows.length; i++) {
    tbody.appendChild(rows[i]);
}        


That code works for a table like the following

&lt;table id='tbl'&gt;
  &lt;tbody id='tbody'&gt;
    &lt;tr&gt;&lt;td&gt;D&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;A&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;C&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;E&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;F&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;B&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;D&lt;/td&gt;&lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;


Using data to sort instead of HTML

If you have some underlying data for the table, it will be even faster since you won't need to read the DOM (except for an id attribute)

var data  = [
   {id: 1, value: 'C'},
   {id: 2, value: 'B'},
   {id: 3, value: 'D'},
   {id: 4, value: 'A'}
];


And your HTML looks like

&lt;table id='tbl'&gt;
  &lt;tbody id='tbody'&gt;
    &lt;tr id='row-1'&gt;&lt;td&gt;C&lt;/td&gt;&lt;/tr&gt;
    &lt;tr id='row-2'&gt;&lt;td&gt;B&lt;/td&gt;&lt;/tr&gt;
    &lt;tr id='row-3'&gt;&lt;td&gt;D&lt;/td&gt;&lt;/tr&gt;
    &lt;tr id='row-4'&gt;&lt;td&gt;A&lt;/td&gt;&lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;


Here's the code to sort the table

var table = document.getElementById('tbl');
// Can't call sort on an HTML collection, so copy the contents to an array
data.sort(function(a, b) {
    return a.value &gt; b.value ? 1 : (b.value &gt; a.value ? -1 : 0);
});
var tbody = document.getElementById('tbody');
for (var i=0; i &lt; data.length; i++) {
    tbody.appendChild(document.getElementById('row-' + data[i].id));
}