PDA

View Full Version : [Solved]comboboxes crowded together in a window



blademan_stu
21 Apr 2008, 7:32 PM
hi everyone ,I use a toolbar to contains serveral comboboxes ,when I put this toolbar and a grid in a tabpanel,they displays fine.When I click a button in the tbar of the grid ,it will show a cardlayout window,and one of the cards contains the toolbar and the grid either.But the comboboxes crowded together now.The effect ,pls refer to the attachment.

the highlighted two parts are the same toolbar class.One is in tabpanel ,the other is in a window.

thanks in advance

blademan_stu
23 Apr 2008, 7:24 PM
nobody meet this problem?
I use the toolbar and combobox like this,extend the Ext.Toolbar,and includes the comboboxes directly in items.Not like the examples use "toolbar.addField(combo);"Is it why this is wrong?



gridToolbar = Ext.extend(Ext.Toolbar,{
initComponent:function(){
Ext.apply(this,{
items:[{
text: this.searchtext,
id:'dosearchButton'
},"-",{
xtype: 'tbtext',
text: this.positiontext
},
new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
selectOnFocus:true,
width:100,
id:this.positionCatalogId,
store: new Ext.data.Store({
url: 'company.do',
baseParams:{method:'loadPosCatalog'},
reader: new Ext.data.JsonReader({
root: 'obs',
fields: [
'obId', 'obName'
]
})
}),
valueField :"obId",
displayField: "obName"
}),"-",{
xtype:'tbtext',
text:this.deptext
},new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
selectOnFocus:true,
id:this.depId,
width:100,
listWidth:200,
store: new Ext.data.Store({
url: 'company.do',
baseParams:{method:'loadDepartmentInCompany'},
reader: new Ext.data.JsonReader({
root: 'obs',
fields: [
'obId', 'obName'
]
})
}),
valueField :"obId",
displayField: "obName"
}),"-",{
xtype:'tbtext',
text:this.areatext
},new Ext.form.ComboBox({
fieldLabel:'area',
typeAhead: true,
triggerAction: 'all',
selectOnFocus:true,
width:100,
id:this.areaId,
store: new Ext.data.Store({
url: 'company.do',
baseParams:{method:'loadArea'},
reader: new Ext.data.JsonReader({
root: 'obs',
fields: [
'obId', 'obName'
]
})
}),
valueField :"obId",
displayField: "obName"
}),"-",{
xtype:'tbtext',
text:this.statustext
},new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
selectOnFocus:true,
width:100,
id:this.statusId,
store: new Ext.data.Store({
url: 'company.do',
baseParams:{method:'loadPosStatus'},
reader: new Ext.data.JsonReader({
root: 'obs',
fields: [
'obId', 'obName'
]
})
}),
valueField :"obId",
displayField: "obName"
}),"-",{
xtype:'tbtext',
text:this.grouptext
},new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
selectOnFocus:true,
width:100,
id:this.posGroupId,
store: new Ext.data.Store({
url: 'company.do',
baseParams:{method:'loadPosGroup'},
reader: new Ext.data.JsonReader({
root: 'obs',
fields: [
'obId', 'obName'
]
})
}),
valueField :"obId",
displayField: "obName"
})]
});
gridToolbar.superclass.initComponent.apply(this,arguments);
}
});

Animal
23 Apr 2008, 11:38 PM
Yes, I had this problem, but I forget how I solved it... I'll try to remember

Animal
23 Apr 2008, 11:49 PM
Hmm, I can't reproduce that in my examples/menu example when I put another state selection CmoboBox in the Toolbar.

Try using the Container-based Toolbar from here: http://extjs.com/forum/showthread.php?p=122647#post122647

blademan_stu
6 May 2008, 11:37 PM
thanks animal,but it doesn't work in my situation.maybe something is wrong in my code.
Yesterday I found a solution,but a little ugly:(
1in the config time,the toolbar has no comboboxes
2in the config time,wrap the toolbar in a Panel
3in the cardLayout Form ,when active this not-well-displayed page,add all the combos in the toolbar and call the wrapped Panel to doLayout()
4be careful ,the add comboes operation just executes once ,you can use toolbar.items.length to testfy it,otherwise the toolbar will have many comboes when enter in the page next time

P.S.
in another situation,the comboes crowded together again.It's in a tabpanel tab.I call the tabpanel doLayout.And it works.But in cardlayout,maybe the dolayout executed just in the beginning,so when I entered the later page of the cardForm,it missed the calculate of the positions.