拜求大神:需求:
1、必须在1.2版本下
2、浏览器大小变化时,test表 边框已调好,如何调整每个列宽 自适应表格宽度(不刷新reload情况下,就是不知如何获取每个列宽)
不知如何获取 datagrid  列宽 
页面源码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jQuery EasyUI</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../themes/icon.css">
<script type="text/javascript" src="../jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../jquery.easyui.min.js"></script>
<script>
$(function(){
var width2 = window.innerWidth*0.97;
 var bodyWidth = document.body.clientWidth;
//alert(bodyWidth);
$('#test').datagrid({
title:'My Title',
iconCls:'icon-save',
nowrap: false,
striped: true,
collapsible:true,
url:'datagrid_data.json',
sortName: 'code',
sortOrder: 'desc',
remoteSort: false,
idField:'code',
frozenColumns:[[
                {field:'ck',checkbox:true},
                {title:'code',field:'code',sortable:true}
]],
columns:[[
        {title:'Base Information',colspan:3},
{field:'opt',title:'Operation',width:(width2-95)*0.20,align:'center', rowspan:2,
formatter:function(value,rec){
return '<span style="color:red" width='+(width2-95)*0.20+'>Edit Delete</span>';
}
}
],[
{field:'name',title:'Name',width:(width2-95)*0.25},
{field:'addr',title:'Address',width:(width2-95)*0.25,rowspan:2,sortable:true,
sorter:function(a,b){
return (a>b?1:-1);
}
},
{field:'col4',title:'Col41',width:(width2-95)*0.25,rowspan:2}
]],
pagination:true,
rownumbers:true,
toolbar:[{
id:'btnadd',
text:'Add',
searchItems:[{id:"searchAutName",//文本框的id
                           text:'权限名称',//文本标签
                           field:'authName',//文本框的name
                           size:10//文本框的长度
                          },{id:"searchAutName",//文本框的id
                           text:'权限名称',//文本标签
                           field:'authName',//文本框的name
                           size:10//文本框的长度
                          },{id:"searchAutName",//文本框的id
                           text:'权限名称',//文本标签
                           field:'authName',//文本框的name
                           size:10//文本框的长度
                          }],//自己手动添加的搜索文本框
iconCls:'icon-add',
handler:function(){
$('#btnsave').linkbutton('enable');
alert('add')
}
},{
id:'btncut',
text:'Cut',
iconCls:'icon-cut',
handler:function(){
$('#btnsave').linkbutton('enable');
alert('cut')
}
},'-',{
id:'btnsave',
text:'Save',
disabled:true,
iconCls:'icon-save',
handler:function(){
$('#btnsave').linkbutton('disable');
alert('save')
}
}]
});
var p = $('#test').datagrid('getPager');
if (p){
$(p).pagination({
onBeforeRefresh:function(){
alert('before refresh');
}
});
}
});

<!-- 浏览器窗口 变化时触发函数 -->
$(window).resize(function(){
  resize();
});
function resize(){
//alert(window.innerWidth*0.98);
$('#test').datagrid('resize', {
width:window.innerWidth*0.97
});
alert($("#tt").attr("columns"));
//alert($('#addr').html());
//alert($('#addr').html());
//$("th:parent").each(function(i) {
//this.style.backgroundColor = '#dddddd';
//alert(this.width); //this.style.width = window.innerWidth*0.97*0.16
//this.field="dddd"
//$(this).attr("field","ccc");
//});
//$("th:parent").css("width","20px");
}
function getSelected(){
var selected = $('#test').datagrid('getSelected');
if (selected){
alert(selected.code+":"+selected.name+":"+selected.addr+":"+selected.col4);
}
}
function getSelections(){
var ids = [];
var rows = $('#test').datagrid('getSelections');
for(var i=0;i<rows.length;i++){
ids.push(rows[i].code);
}
alert(ids.join(':'));
}
function clearSelections(){
$('#test').datagrid('clearSelections');
}
function selectRow(){
$('#test').datagrid('selectRow',2);
}
function selectRecord(){
$('#test').datagrid('selectRecord','002');
}
function unselectRow(){
$('#test').datagrid('unselectRow',2);
}
function mergeCells(){
$('#test').datagrid('mergeCells',{
index:2,
field:'addr',
rowspan:2,
colspan:2
});
}
</script>
</head>
<body>
<h1>DataGrid</h1>
<div style="margin-bottom:10px;">
<a href="#" onclick="resize()">resize</a>
<a href="#" onclick="getSelected()">getSelected</a>
<a href="#" onclick="getSelections()">getSelections</a>
<a href="#" onclick="clearSelections()">clearSelections</a>
<a href="#" onclick="selectRow()">selectRow</a>
<a href="#" onclick="selectRecord()">selectRecord</a>
<a href="#" onclick="unselectRow()">unselectRow</a>
<a href="#" onclick="mergeCells()">mergeCells</a>
</div>

<table id="test"></table>
<div id="xx"  style="background-color :#00FF00;width:95px"> 95px</div>
</body>
</html>