PDA

View Full Version : horizontal scrollbar in Ext.grid.GroupingView?



aomai0186
13 Jul 2009, 1:27 AM
I can't show a horizontal scrollbar, my grid have a lot of columns and I set width in each column, but when a render every column have set the other width. Do You know any parameter to show scroll horizontal? I'm applying your script, congratulations it's fantastic. Sorry for my poor english.


var pageSize = 20;
Ext.onReady(function() {
var sm = new Ext.grid.CheckboxSelectionModel({ handleMouseDown: Ext.emptyFn }); //????????????????????????
var cm = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer()
, sm
, { header: '??', dataIndex: 'recordID' }
, { header: '???', dataIndex: 'flightCode', sortable: true }
//,{header:'???',dataIndex:'sequence'}
, { header: '??', dataIndex: 'duration', sortable: true, editor: new Ext.grid.GridEditor(new Ext.form.TextField({
allowBlank: false
}))
}
, { header: '????', dataIndex: 'dairportCode', editor: new Ext.grid.GridEditor(new Ext.form.TextField({
allowBlank: false
}))
}
, { header: '????', dataIndex: 'aairportCode', editor: new Ext.grid.GridEditor(new Ext.form.TextField({
allowBlank: false
}))
}
, { header: '????', dataIndex: 'dtime' }
, { header: '????', dataIndex: 'atime' }
, { header: '????(?)', dataIndex: 'startDate', sortable: true, renderer: Ext.util.Format.dateRenderer('Y-m-d') }
, { header: '????(?)', dataIndex: 'endDate', sortable: true, renderer: Ext.util.Format.dateRenderer('Y-m-d') }
, { header: '????', dataIndex: 'serviceType', editor: new Ext.grid.GridEditor(new Ext.form.TextField({
allowBlank: false
}))
}
, { header: '????', dataIndex: 'status4display', sortable: true }
, { header: '??', dataIndex: 'memo', editor: new Ext.grid.GridEditor(new Ext.form.TextField({
allowBlank: false
}))
}
]);

//testing data
var data = { "totalProperty": "10", "root": [
{ "aairportCode": "HDG", "airlineCode": "VD", "atime": "0925", "blockTime": "", "createDate": "2009-00-22", "dairportCode": "XIY", "dtime": "0815", "duration": "1.3.5..", "endDate": "2009-00-09", "equipmentCode": "XXX", "flightCode": "VD8301", "flightNo": "8301", "memo": "", "recordID": "4218", "relativeDay": "0", "scheduleName": "week", "sequence": 0, "serviceType": "G", "startDate": "2009-00-05", "status1": "N", "status2": "N", "status4display": "???" },
{ "aairportCode": "XMN", "airlineCode": "VD", "atime": "1200", "blockTime": "", "createDate": "2009-00-22", "dairportCode": "HDG", "dtime": "1000", "duration": "1.3.5..", "endDate": "2009-00-09", "equipmentCode": "XXX", "flightCode": "VD8301", "flightNo": "8301", "memo": "", "recordID": "3556", "relativeDay": "0", "scheduleName": "week", "sequence": 0, "serviceType": "G", "startDate": "2009-00-05", "status1": "N", "status2": "N", "status4display": "???" },
{ "aairportCode": "HDG", "airlineCode": "VD", "atime": "1450", "blockTime": "", "createDate": "2009-00-22", "dairportCode": "XMN", "dtime": "1240", "duration": "1.3.5..", "endDate": "2009-00-09", "equipmentCode": "XXX", "flightCode": "VD8302", "flightNo": "8302", "memo": "", "recordID": "4082", "relativeDay": "0", "scheduleName": "week", "sequence": 0, "serviceType": "G", "startDate": "2009-00-05", "status1": "N", "status2": "N", "status4display": "???" },
{ "aairportCode": "XIY", "airlineCode": "VD", "atime": "1700", "blockTime": "", "createDate": "2009-00-22", "dairportCode": "HDG", "dtime": "1530", "duration": "1.3.5..", "endDate": "2009-00-09", "equipmentCode": "XXX", "flightCode": "VD8302", "flightNo": "8302", "memo": "", "recordID": "4210", "relativeDay": "0", "scheduleName": "week", "sequence": 0, "serviceType": "G", "startDate": "2009-00-05", "status1": "N", "status2": "N", "status4display": "???" },
{ "aairportCode": "LYI", "airlineCode": "VD", "atime": "1615", "blockTime": "", "createDate": "2009-00-22", "dairportCode": "XIY", "dtime": "1445", "duration": ".2.4.6.", "endDate": "2009-00-10", "equipmentCode": "XXX", "flightCode": "VD8303", "flightNo": "8303", "memo": "", "recordID": "3666", "relativeDay": "0", "scheduleName": "week", "sequence": 0, "serviceType": "J", "startDate": "2009-00-06", "status1": "N", "status2": "N", "status4display": "???" },
{ "aairportCode": "WEH", "airlineCode": "VD", "atime": "1800", "blockTime": "", "createDate": "2009-00-22", "dairportCode": "LYI", "dtime": "1700", "duration": ".2.4.6.", "endDate": "2009-00-10", "equipmentCode": "XXX", "flightCode": "VD8303", "flightNo": "8303", "memo": "", "recordID": "3499", "relativeDay": "0", "scheduleName": "week", "sequence": 0, "serviceType": "J", "startDate": "2009-00-06", "status1": "N", "status2": "N", "status4display": "???" },
{ "aairportCode": "LYI", "airlineCode": "VD", "atime": "1935", "blockTime": "", "createDate": "2009-00-22", "dairportCode": "WEH", "dtime": "1835", "duration": ".2.4.6.", "endDate": "2009-00-10", "equipmentCode": "XXX", "flightCode": "VD8304", "flightNo": "8304", "memo": "", "recordID": "4128", "relativeDay": "0", "scheduleName": "week", "sequence": 0, "serviceType": "J", "startDate": "2009-00-06", "status1": "N", "status2": "N", "status4display": "???" },
{ "aairportCode": "XIY", "airlineCode": "VD", "atime": "2230", "blockTime": "", "createDate": "2009-00-22", "dairportCode": "LYI", "dtime": "2030", "duration": ".2.4.6.", "endDate": "2009-00-10", "equipmentCode": "XXX", "flightCode": "VD8304", "flightNo": "8304", "memo": "", "recordID": "3454", "relativeDay": "0", "scheduleName": "week", "sequence": 0, "serviceType": "J", "startDate": "2009-00-06", "status1": "N", "status2": "N", "status4display": "???" },
{ "aairportCode": "THQ", "airlineCode": "VD", "atime": "0930", "blockTime": "", "createDate": "2009-00-22", "dairportCode": "XIY", "dtime": "0850", "duration": "...4...", "endDate": "2009-00-08", "equipmentCode": "XXX", "flightCode": "VD8305", "flightNo": "8305", "memo": "", "recordID": "3695", "relativeDay": "0", "scheduleName": "week", "sequence": 0, "serviceType": "G", "startDate": "2009-00-08", "status1": "N", "status2": "N", "status4display": "???" },
{ "aairportCode": "HHA", "airlineCode": "VD", "atime": "1440", "blockTime": "", "createDate": "2009-00-22", "dairportCode": "FOC", "dtime": "1330", "duration": "1.3.5..", "endDate": "2009-00-09", "equipmentCode": "EMB", "flightCode": "VD8308", "flightNo": "8308", "memo": "", "recordID": "3483", "relativeDay": "0", "scheduleName": "week", "sequence": 0, "serviceType": "G", "startDate": "2009-00-05", "status1": "N", "status2": "N", "status4display": "???(???)" },
{ "aairportCode": "XIY", "airlineCode": "VD", "atime": "1700", "blockTime": "", "createDate": "2009-00-22", "dairportCode": "HHA", "dtime": "1520", "duration": "1.3.5..", "endDate": "2009-00-09", "equipmentCode": "EMB", "flightCode": "VD8308", "flightNo": "8308", "memo": "", "recordID": "3989", "relativeDay": "0", "scheduleName": "week", "sequence": 0, "serviceType": "G", "startDate": "2009-00-05", "status1": "N", "status2": "N", "status4display": "???(???)" }
]
};

var store = new Ext.data.GroupingStore({
proxy: new Ext.data.MemoryProxy(data)
, groupField: 'duration'
//,remotesort:true //??????
, sortInfo: { field: 'duration', direction: "ASC" }
, reader: new Ext.data.JsonReader({
id: "id"
, totalProperty: "totalProperty"
, root: "root"
}, [
{ name: 'recordID' }
, { name: 'flightCode' }
, { name: 'duration' }
, { name: 'dairportCode' }
, { name: 'aairportCode' }
, { name: 'dtime' }
, { name: 'atime' }
, { name: 'startDate', type: 'date', dateFormat: 'Y-m-d' }
, { name: 'endDate', type: 'date', dateFormat: 'Y-m-d' }
, { name: 'serviceType' }
, { name: 'status4display' }
, { name: 'memo' }
])
});
var grid = new Ext.grid.EditorGridPanel({
title: 'Sabre????',
store: store,
cm: cm,
sm: sm,
view: new Ext.grid.GroupingView({
scrollOffset: 50
, groupByText: '?????'
, showGroupsText: '????'
, forceFit: true //????????
, groupTextTpl: '{text} ( ? {[values.rs.length]} ? )'
}),
renderTo: 'grid',
autoHeight: true,
loadMask: { msg: '???????????....' },
stripeRows: true, //???
width: 200,
bbar: new Ext.PagingToolbar({
pageSize: pageSize
, store: store
, displayInfo: true
, displayMsg: '??? {0} ?? {1} ?????? {2} ?'
, emptyMsg: "????"
})
});
store.load({ params: { start: 0, limit: pageSize} });
});

Animal
13 Jul 2009, 1:28 AM
It's autoHeight that is the problem.

Size your grid.