lstroud
1 Oct 2007, 11:10 AM
I have been able to work around it. However, I had some difficulty with combo resizing. I tried setting grow to true. However, it seemed to always cut about a letter off of my data. (that may be the actual bug here). I then tried setting the width, that only seems to effect the size of the list and not the box itself. Ultimately, I had to do the following:
this.ccncombo = new Ext.form.ComboBox({
renderTo: 'ccn',
store: this.ccnstore,
displayField:'description',
valueField: 'id',
typeAhead: false,
forceSelection: true,
readOnly: true,
// grow: true,
// growMax: 1000,
// growMin: 30,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a ccn...',
selectOnFocus:true
//height: 19
});
setCcns : function(ccnXml){
var prefs = Framework.getUser().preferences;
if(prefs.showCcnName){
this.ccncombo.displayField = "description";
this.ccncombo.el.setWidth("209");
this.ccncombo.setWidth("235");
}
else{
this.ccncombo.displayField = "id";
this.ccncombo.el.setWidth("74");
this.ccncombo.setWidth("100");
}
this.ccns = ccnXml;
this.ccnstore.proxy.data = ccnXml;
this.ccnstore.reload();
//if only one ccn then remove the combo box and use a label instead
if(this.ccnstore.getCount() < 2){
this.ccncombo.hide();
var ccnEl = Ext.get("ccn");
var theccn;
if(prefs.showCcnName)
theccn = this.ccnstore.getAt(0).description;
else
theccn = this.ccnstore.getAt(0).id;
Ext.DomHelper.append(ccnEl, "<span id='ccnName'>" + theccn + "</span>");
}else{
Ext.DomHelper.insertFirst(this.ccncombo.el, "<span id='ccnIdentifier'>Ccn: </span>")
}
this.doLayout();
},
It's low hanging fruit, but it would be nice if there were a reliable way to expand the width of a combo based on the data. (Of course, I could be doing something wrong :)).
LES
this.ccncombo = new Ext.form.ComboBox({
renderTo: 'ccn',
store: this.ccnstore,
displayField:'description',
valueField: 'id',
typeAhead: false,
forceSelection: true,
readOnly: true,
// grow: true,
// growMax: 1000,
// growMin: 30,
mode: 'local',
triggerAction: 'all',
emptyText:'Select a ccn...',
selectOnFocus:true
//height: 19
});
setCcns : function(ccnXml){
var prefs = Framework.getUser().preferences;
if(prefs.showCcnName){
this.ccncombo.displayField = "description";
this.ccncombo.el.setWidth("209");
this.ccncombo.setWidth("235");
}
else{
this.ccncombo.displayField = "id";
this.ccncombo.el.setWidth("74");
this.ccncombo.setWidth("100");
}
this.ccns = ccnXml;
this.ccnstore.proxy.data = ccnXml;
this.ccnstore.reload();
//if only one ccn then remove the combo box and use a label instead
if(this.ccnstore.getCount() < 2){
this.ccncombo.hide();
var ccnEl = Ext.get("ccn");
var theccn;
if(prefs.showCcnName)
theccn = this.ccnstore.getAt(0).description;
else
theccn = this.ccnstore.getAt(0).id;
Ext.DomHelper.append(ccnEl, "<span id='ccnName'>" + theccn + "</span>");
}else{
Ext.DomHelper.insertFirst(this.ccncombo.el, "<span id='ccnIdentifier'>Ccn: </span>")
}
this.doLayout();
},
It's low hanging fruit, but it would be nice if there were a reliable way to expand the width of a combo based on the data. (Of course, I could be doing something wrong :)).
LES