3.2.0

How do you set the column width bases on the data in each cell

How do you set the column width bases on the data in each cell
I want to set the column width dynamical bases on the data in the cell so the users does have to resize the columns to see the data.
i Have search the forums and I see nothing in 2.5 someone had something working in 1.0.
But that doesn't do me any good.
I have multi table on each page the data is coming from mysql from php to js array.
The number of columns and data can change on every redrawn of the page.

So I need this in javascript a css doesn't work
Please help.
Thanks
Steven Fransen
Steven Fransen
May 7,
I think I will figure out the column width in php and saved as array when I do the
$SavedStrLen = array();
function aw_cells($dataset,$dataset1)
{
$rows = array();
while ($fields = @mysql_fetch_field($dataset1))
{
$fieldsarray[] = $fields->name;
}
while ($record = @mysql_fetch_row($dataset))
{
$rowCount = count($record);
$cols = array();
for($i = 0; $i < $rowCount; $i++)
{
$cols[] = '"'.addslashes($record[$i].'"';
GetMaxStrLength( $fieldsarray[$i] , $record[$i] );
}
$rows[] = "\t[".implode(",", $cols)."]";
$rows1[] = implode(';',$cols);
}
echo "[\n".implode(",\n",$rows)."\n];\n";
}
function GetMaxStrLength( $WhoseString, $newString )
{
global $SavedStrLen;

$StrLen = strlen($newString);
if ( $StrLen > $SavedStrLen[$WhoseString] )
$SavedStrLen[$WhoseString] = $StrLen;
}

I will save the key names and the max charatcers
Does this sound like the right way of doing this or am I totally missing something.
thanks
Steven
Steven Fransen
May 7,
OOPS
replace line
$cols[] = '"'.addslashes($record[$i].'"';
with this line
$cols[] = '"'.addslashes($record[$i].'"');

Sorry I should have wrote it outside of this forum first.

Steven Fransen
May 7,
http://www.activewidgets.com/javascript.forum.19561.4/contribution-double-click-header-separator.html
May 8,
Yes but I want all the columns to be drawn correct on page load and to have to do that all the time doesn't sound right.
I think my way is going to be faster and clean for the user.
As this doesn't resize the grid to handle this resize and it there is just 1 column you can double the separator as there is no separator.

Thanks anyway but I have my almost done.
I will post my answer when all done here.
Steven
Steven Fransen
May 8,
Here is my javascript answer working a php answer as this doesn't scale well
I tested to about 5000 rows to OK 50K is too slow.
I how my php answer is better.

I tested it with html link in most of the cells.

here is full code
Steven Fransen
May 8,
<html>
<head>
<script src="runtime/lib/aw.js"></script> 
<link href="runtime/styles/runtime/styles/aqua/aw.css" rel="stylesheet" >
</head>
<body>
<script>
try
{

var adjustment = 15; // Ajustment for cells widths

var myColumns = [
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:00:09:38>00:17:f2:00:09:38</A>","2009-04-02 19:24:54","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7548908>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f8>1.7f8</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B04>MP11.005C.B04</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7548908"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:00:09:38>00:17:f2:00:09:38</A>","2009-04-03 10:55:05","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549697>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f8>1.7f8</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B04>MP11.005C.B04</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549697"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:00:09:38>00:17:f2:00:09:38</A>","2009-04-02 19:24:54","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7548908>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f8>1.7f8</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B04>MP11.005C.B04</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7548908"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:00:09:38>00:17:f2:00:09:38</A>","2009-04-03 10:55:05","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549697>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f8>1.7f8</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B04>MP11.005C.B04</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549697"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:00:09:38>00:17:f2:00:09:38</A>","2009-04-02 19:24:54","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7548908>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f8>1.7f8</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B04>MP11.005C.B04</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7548908"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:00:09:38>00:17:f2:00:09:38</A>","2009-04-03 10:55:05","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549697>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f8>1.7f8</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B04>MP11.005C.B04</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549697"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"],
["<A href=http://www.yoursite.com/docs/foo/web2.php?machineID=00:17:f2:02:46:96>00:17:f2:02:46:96</A>","2009-04-03 10:52:23","<A href=http://www.yoursite.com/docs/foo/testCaseReport.php?testCase=3>fstestAutomation.sh testCase 1</A> (<A href=http://www.yoursite.com/docs/foo/testSummary.php?trID=7549694>Config</A>)","Pass","0","<A href=http://www.yoursite.com/docs/foo/osSummary.php?osRelease=9G3543>Mac OS X 10.5.6 9G3543</A>","<A href=http://www.yoursite.com/docs/foo/smcSummary.php?smcVersion=1.7f10>1.7f10</A>","<A href=http://www.yoursite.com/docs/foo/efiSummary.php?efiVersion=MP11.005C.B07>MP11.005C.B07</A>","<A href=http://www.yoursite.com/docs/foo/platformSummary.php?modelMajor=foo>foo</A>","7549694"]
];


var obj = new AW.UI.Grid;
obj.setCellText(myColumns);
var Theheader = ["machineID", "Start_Time", "Description", "Results", "Pass_Count", "OS", "SMC", "EFI", "Model", "Test_results_ID"];
obj.setHeaderText(Theheader);

var TotalColumnsNumbers = Theheader.length;
var rowcount = myColumns.length;

// enable virtual mode
obj.setVirtualMode(true);

obj.setColumnCount(TotalColumnsNumbers);
obj.setRowCount(rowcount);
obj.setRowHeight(20);

obj.setCellEditable(false);

function AutoResize(TotalColumnsNumbers)
{
var TotalTableWidth = 19;
var SetSize = 0;

// I had to write the hidden field here to make it work
document.write('<span id="mine" style="font-size:11px;font-family:Tahoma;width:auto;visibility:hidden;white-space:nowrap;"></span><br>');
var hiddenSpan = document.getElementById("mine");
for ( var hh = 0; hh < TotalColumnsNumbers; hh++)
{
var MaxLength = 0;
for (var i = 0; i < obj.getRowCount(); i++)
{
var text1 = obj.getCellText(hh, i);
hiddenSpan.innerHTML = text1;

if (hiddenSpan.offsetWidth > MaxLength)
MaxLength = hiddenSpan.offsetWidth;
}
var Currentsize = obj.getColumnWidth(hh);

var text = obj.getHeaderText(hh, 0);

hiddenSpan.innerHTML = text;
if (hiddenSpan.offsetWidth > MaxLength)
{
MaxLength = hiddenSpan.offsetWidth;
}
SetSize = (MaxLength + adjustment);

obj.setColumnWidth(SetSize , hh);
//document.write("col # " + hh + " CurrentSize = " + Currentsize + " NewSize = " + SetSize + " Max Text length = " + MaxLength + "<br>");
}
// Resize the table to fit the new column widths
for ( var hh = 0; hh < TotalColumnsNumbers; hh++)
{
var tempcolum = obj.getColumnWidth(hh);
TotalTableWidth = TotalTableWidth + tempcolum;
}
obj.setStyle("width", TotalTableWidth + "px");

// Don't show all of the table is really large
if(myColumns.length >= 100)
obj.setStyle("height", "600px");
else
{
size = 96 + (myColumns.length * 18 - 16);
obj.setStyle("height", size);
}
}
AutoResize(TotalColumnsNumbers); // Just Pass in the number of Columns you have

document.write(obj);
}
catch(ex)
{
alert ("error " + ex);
}

</script>
</body>
</html>
Steven Fransen
May 8,

This topic is archived.

See also:


Back to support forum