PDA

View Full Version : Grid column width as autofit



renganathan
28 Oct 2011, 4:46 AM
Hi all,

i want to do auto fit for all column based on the content without using
Forcefit: true;

Guys please help me to fix this problem

Here is my code




// view port
var vport = new Ext.Viewport(
{
layout : 'border',
items :
[
{
height : 70,
// autoWidth : true,
region : 'north',
border : true,
items :
[
{
xtype : 'box',
width : '18%',
autoEl : {tag: 'img', src:'./ciscologo.png'}
},
{
xtype : 'panel',
// autoWidth : true,
items :
[
{
xtype : 'button',
text : 'Button 1'
},
{
xtype : 'button',
text : 'Button 2'
}
]
}
]
},
{
width : '250',
region : 'west',
layout : 'fit',
collapsible : true,
title : 'Navigation Panel',
items : [navPanel]
},
{
autoWidth : true,
region : 'center',
layout : 'fit',
items : [grid]
}
]
});

// Grid code

var grid = new Ext.grid.GridPanel(
{
id : 'gridPan',
autoScroll : true,
store : dstore,
title : 'Grid Panel',
columns :
[
{id:'ipaddr', header: "ipaddr", sortable: true, dataIndex: 'ipaddr'},
{id: 'devicetype', header: "devicetype", dataIndex: 'devicetype'},
{id:'status', header: "status", dataIndex: 'status'},
{id: 'description', header: "description", dataIndex: 'description'}
],
columnLines : true,
loadMask : true,
stripeRows: true,
autoExpandColumn: 'description'
});




when i am using forcefit is true, i am facing some problem like (Reloading problem,Horizontal scroll not coming and etc)

Thanks in advance,

Renganathan

skirtle
28 Oct 2011, 6:30 AM
Please indent your code properly before posting it. There's not much point using CODE tags if you don't include decent indentation.

Your question is quite confusing. Your grid has 4 columns. Could you describe exactly how you'd like each of them to be sized?

I also see a lot of ExtJS 3 in your code. Are you are using ExtJS 3 or 4?