为表格加入fitColumns:true属性,同时必须为每个字段加入width:10属性,如:
$(function(){
$('#tt').datagrid({
url: 'datagrid_data3.json',
title: 'DataGrid',
width: 600,
height: 220,
fitColumns: true,
nowrap:false,
rownumbers:true,
showFooter:true,
columns:[[
{field:'itemid',title:'Item ID',width:10},
{field:'productid',title:'Product ID',width:10},
{field:'listprice',title:'List Price',width:10,align:'right'},
{field:'unitcost',title:'Unit Cost',width:10,align:'right'},
{field:'attr1',title:'Attribute',width:10},
{field:'status',title:'Status',width:10,align:'center'}
]]
});
});
转载请注明出处