PDA

View Full Version : GridPanel hbox align stretch



richmond
23 Feb 2012, 5:40 AM
Attempting to present a screen from a grid where one record would occupy the complete container, two records would each occupy 50% of container and so on. Have searched the documentation and examples at
length but your examples appear to be utilizing static data, hence cannot find an example rendering a
grid panel incorporating "hbox" and "align:stretch" layout is well presented.

This code is my current state of confusion and is yielding an error in Firebug to the effect "headerCtCfg is undefined". Any push in the right direction would be greatly appreciated since as you can quickly discern
I am new to EXT.


Ext.define('schedule', {
extend: 'Ext.data.Model',
fields: [
{name:'Spur', type:'short'},
{name:'CurrentTIC', type:'string'},
{name:'PendingTIC', type:'string'},
{name:'LastTID', type:'string'}
]
});

var schedStore = Ext.create('Ext.data.Store', {
storeId: 'schedStore',
model: 'schedule',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'getSched.jsp',
extraParams: {
busModule: module
},
reader: {
type: 'json',
root: 'schedules',
totalProperty: 'SchedCount'
}
},
listeners: {
load: {
fn: function() {

Ext.create( 'Ext.Viewport', {
layout: 'border',
items: [{
region: 'center',
layout: 'fit',
items: [{
xtype: 'grid',
store: schedStore,
layout: {
type: 'hbox',
align: 'stretch'
},
items: [{
xtype: 'gridcolumn',
align: 'center',
flex: 1,
dataIndex: 'Spur'
},{
xtype: 'gridcolumn',
align: 'center',
flex: 1,
dataIndex: 'CurrentTIC'
},{
xtype: 'gridcolumn',
align: 'center',
flex: 1,
dataIndex: 'PendingTIC'
},{
xtype: 'gridcolumn',
align: 'center',
flex: 1,
dataIndex: 'LastTID'
}]
/*
columns: [{
align : 'center',
flex : 1,
//sortable : false,
dataIndex: 'Spur'
},{
align : 'center',
flex : 1,
//sortable : false,
dataIndex: 'CurrentTIC'
},{
align : 'center',
flex : 1,
//sortable : false,
dataIndex: 'PendingTIC'
},{
align : 'center',
flex : 1,
//sortable : false,
dataIndex: 'LastTID'
}]
*/
}]
}]
})
}
}
}
});

mitchellsimoens
23 Feb 2012, 8:28 AM
The grid isn't meant to use hbox layout.