set table cell width with w/ jQuery
<p>Ok, here's a puzzler...</p>

<p>I have a table that is drawn dynamically. Categories labels go in YELLOW, items labels in green.</p>

<p><img src="http://i.stack.imgur.com/76YxV.gif" alt="enter image description here"></p>

<p>The area where the table is located is limited, so I need to truncate long labels inside cells using jQuery plugin. The plugin allows using either numeric value for width or "auto", however I would like to add some login to determine what the numeric values should be.</p>

<p>Table width is 700px. 
I can also use jQuery to count how many category columns exist.
I also can determine what is the widest label in Green area. Here's my code:</p>

<pre><code>// widest item label (GREEN)
var w = 0;
$(".tData tr td:nth-child(1)").each(function(){
    if($(this).width() &gt; w){
        w = $(this).width();
    }
});

// count category columns (YELLOW)
var colCount = 0;
$(".tData tr:first th:gt(0)").each(function () {
    if ($(this).attr("colspan")) {
        colCount += +$(this).attr("colspan");
    } else {
        colCount++;
    }
});

var tableWidth = 700,
    minWidthCat  = 30,
    maxWidthCat = 100,
    minWidthItem = 100
    maxWidthItem = 300;

widthCat =  minWidthCat;
widthItem = minWidthItem;

catWmin = Math.floor((tWidth - minWidthCard) / colCount);
catWmax = Math.floor((tWidth - maxWidthCard) / colCount);

// NEED HELP HERE!!!
if () {

}

// truncate categories
$(".tData tr:first th:gt(0)").truncate({
    width: widthCat
});

// truncate items
$(".tData tr td:nth-child(1)").truncate({
    width: widthItem
});
</code></pre>

<p>Need help with logic that makes the most sense. If I  don't have to truncate I rather not set the width for <strong>Category columns</strong>, but they have to be <strong>all the same width</strong>. </p>
