colResizable appears to be a great plugin for adjustable column widths.
Unfortunately, it removes the widths which were set originally. I was using whitespace:
After studying the source from github, I found a better way.
The table's layout is changed first when the table is assigned the SIGNATURE class which includes table-layout: fixed;
Just before that, I'm pushing the original column widths into a new array. This array is passed to the createGrips function.
/* init function */
// ...
var originalColumnWidths = new Array();
$.each($('th', t), function () {
originalColumnWidths.push($(this).width());
});
// t.addClass(SIGNATURE) ...
createGrips(t, originalColumnWidths);
When looping through the columns in the createGrips function, I'm assigning the value from the array to the new jQuery wrapped column object instead of the current column width.
// Change the signature
var createGrips = function (t, originalColumnWidths) {
// ...
// Replace that line
c.w = c.width();
// with the following
c.w = originalColumnWidths[i];
That works for me perfectly. Hope it can help someone!