PDA

View Full Version : Problem with a ComboBox



1chiban
28 Nov 2011, 4:48 AM
Hi guys,

I'm trying to build an application using js4 and specifically working on a login window right now. But i'm getting a problem related with a model or store I guess. Here it's my code:


Ext.define('Ext.app.DomainStore', {
extend: 'Ext.data.Store',
require:'Ext.app.DomainModel',
/*fields:[
{name:'cod', type:'int'},
{name:'nome', type:'string'}
],*/
model: 'Ext.app.DomainModel',
data: [
{cod: 1, nome:'Dominio 1'},
{cod: 2, nome:'Dominio 2'}
]
});

this is my store defined in Stores.js


Ext.define('Ext.app.DomainModel', {
extend: 'Ext.data.Model',
fields:[
{name:'cod', type:'int'},
{name:'nome', type:'string'}
]
});
this is my model defined in Models.js

On the login.js file i have declared

...
var DominioStore = Ext.create('Ext.app.DomainStore');
...
store: DominioStore

So what happens is when i try to click on the combobox it shows the items on the store, but it doesn't let me choose them and a loading panel appears. More over, it shows an error on the console: Uncaught TypeError: Cannot call method 'indexOf' of undefined. If i comment the model and declare the fields directly on the store, it doesn't give me any error and works correctly. :s

tobiu
28 Nov 2011, 5:32 AM
looks correct to me, the only thing that i noticed looking strange is:



require:'Ext.app.DomainModel'


i only know this syntax:


requires : ['Ext.app.DomainModel']


feel free to create a bugreport, but provide a short and fully functional example please.

cleung
8 Dec 2011, 1:04 PM
Did you ever figure out the cause of this problem? I am having the exact same issue.
Thanks!