PDA

View Full Version : Strange error when trying to create CombBox



Adamw
17 Mar 2010, 8:00 AM
I am trying to create a comboBox to add to a form and I am getting an error message (found using FireBug) when I am trying to create the ComboBox variable.

Can someone explain to me what I am doing wrong? I am lost.


/**
* Create ComboBox Store
*/
// roleDataRecord for the roleStore
var roleDataRecord = Ext.data.Record.create([
{name: 'Role'},
{name: 'Description'},
{name: 'Modified'}
]); //eo roleDataRecord

// roleStore for roleCombo (ComboBox)
var roleStore = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: 'database.asp', //url to data object (server side script)
method: 'POST'
}),
baseParams: { view: 'header_leftmenu_itemRoles' },
root: 'results',
fields: roleDataRecord
}); // eo var roleStore

// Load Data Store(s)
roleStore.load();

/**
* Create ComboBox for the form
*/
var roleCombo = Ext.form.ComboBox({
store: roleStore,
typeAhead: true,
triggerAction: 'all',
fieldLabel: 'Role',
emptyText: '*',
displayField: 'Role',
selectOnFocus: true
});The error I am getting from FireFox is:


this.addEvents is not a function
'statesave' ext-all-debug.js (line 9244)
I do not understand what Event I am trying to add? And if these are events that are created what is wrong in my comboBox code that would cause this error to appear?

mohan_b
17 Mar 2010, 11:08 AM
Hi Adam,

I am going to save you a lot of time. I had this error and I was running from pillar to post and changed a lot of code to realise that I had forgotten a small three letter word 'new' for the combobox instantiation.

And there you go. :)

Adamw
17 Mar 2010, 11:28 AM
Thanks mohan_b. I new it was something little that I was missing that made a big difference.