View Full Version : ComboBox Extension Scope Issue?

23 Jul 2010, 1:24 PM
Hello Everyone,

I've done my best to search the forums and the internet for the answer to my problem, but it's Friday afternoon and I've kinda hit a brick wall here. Let me start off by saying that the way this combobox is supposed to work is as follows:

Each time a character is added or removed in the box, a query is used to retrieve new data for the store reload. If it's possible to this in a simpler way than that which I am attaching below, please let me know. I'm sure I'm not the first person to try to do something like this.

This new kerberosCombo is also meant to be used as the editor in an editablegrid.

My error is in trying to retrieve the value of the combobox. this.getValue() is giving me blanks. Thanks in advance for taking a look at this. I'm sure it's something very simple.


var store = new Ext.data.JsonStore({
method: 'POST',
url: '/KerberosLookup',
root: 'data',
storeId: 'kerberos',
fields: ['gsKerberosID', 'cn']

function reloadData(s) {
url : '/KerberosLookup',
method : 'POST',
params: {search: s},
success : function(response, opts) {
//decode json string
var responseData = Ext.decode(response.responseText);

//Load store from here

Ext.ux.kerberosCombo = function(config,getStore) {
if(getStore==true) return store; //return new datastore if second param is true

config = config || {};
Ext.apply(config, {
store: store,
displayField : 'cn',
name : "kerberosCombo",
hiddenName : 'kerberosCombo',
emptyText : 'Select Kerberos...',
fieldLabel : 'kerberos',
valueField : 'gsKerberosID',
mode : 'local',
triggerAction : 'all',
selectOnFocus : false,
forceSelection : false,
allowBlank : false,
listeners: {
keyup: function(e) {
var key = Ext.EventObject.getKey();
e = Ext.EventObject;
if(key != e.DOWN && key != e.UP && key != e.LEFT && key != e.RIGHT){
//Dont query unless we have more than 2 characters
if(this.value().length > 2){

//auto expanding of the list:thanks to Animal!
this.on('expand', function(combo){
var w = combo.el.getWidth();
}, this, {single: true});

Ext.extend(Ext.ux.kerberosCombo, Ext.form.ComboBox,{
initComponent:function() {
// call parent initComponent
renderCmbTest:(function(){ //singleton pattern used here!
var instanceStore=null;
return function(v){
if(!instanceStore) {
var a=instanceStore.getById(v);
return a?a.data.cn:null;
editorCmbTest: function(){
return new Ext.grid.GridEditor(new Ext.ux.kerberosCombo({lazyRender:true}));

Ext.reg('kerberosCombo', Ext.ux.kerberosCombo);

23 Jul 2010, 2:27 PM
That's just a normal ComboBox using

mode: 'remote',
minChars: 2,
queryParam: 'search'

But triggerAction: 'all' is not valid for a remote autosuggest combo. All might be 100000000 rows might it not?

AutoSuggest combos usually uses hideTrigger: true