PDA

View Full Version : Controlling Grid Column Widths



jbeaven
22 Apr 2014, 11:44 AM
I know the title seems simple. I myself feel like this should be a simple thing but somehow when I'm adding (or deleting) a width to columns in one of my grids it's doing absolutely nothing to adjust the column size.

The grid is created in a component thusly
{
height:279,
xtype:"manager",
id: "manager",
tools: [
{
id:'help',
qtip: 'help',
handler:showWebHelpCallback("manager.htm")
}
],
cls: "southArea",
region: "south",
split: false,
collapsible: true,
title: "Manager",
header: true,
hidden: hideRightCol,
plugins: new Ext.ux.collapsedPanelTitlePlugin(),
margins: {bottom: 49}
}

With the manager grid just simply
ns.Manager = Ext.extend(GridPanel, {
store: store,
stateId: 'managerState',
colModel: new Ext.grid.ColumnModel({
// defaultSortable: false,
columns: [{
id: 'id',
header: "Name",
// width: 0,
menuDisabled: true,
dataIndex: Ext.ensible.cal.EventMappings.ApplicationId.name
}, {
id: 'date',
header: "Date",
// width: 0,
menuDisabled: true,
css: "padding-left: 13px;",
renderer: Ext.util.Format.dateRenderer('l m/d/Y'),
dataIndex: Ext.ensible.cal.EventMappings.StartDate.name
}, {
id: 'waitListedOn',
header: "Waitlisted On",
// width: 0,
menuDisabled: true,
dataIndex: Ext.ensible.cal.EventMappings.CreatedDate.name
}, {
id: 'groupingByNameColumn',
header: "GroupingBy Column",
// width: 0,
dataIndex: Ext.ensible.cal.EventMappings.GroupingByNameId.name,
hidden: true
}, {
id: 'scheduledFor',
header: "Scheduled For",
// width: 0,
menuDisabled: true,
dataIndex: Ext.ensible.cal.EventMappings.OtherScheduledDays.name
},
{
id: 'unassignedFor',
header: "unassigned For",
// width: 0,
menuDisabled: true,
dataIndex: Ext.ensible.cal.EventMappings.OtherUnassignedDays.name
}]
})

You'll notice that I commented out the width values and still no dice. Any ideas on what could be preventing the adjustment of the column widths?

jbeaven
22 Apr 2014, 12:20 PM
SOLUTION: Solution for those of you wondering if you read this.
stateId: 'managerState' This little piece here maintains the state of the grid column widths in the case that columns are adjustable. Because of this the code that I wrote was getting overridden by the stored columns widths as dictated by the state.