PDA

View Full Version : Simple example with errors



pconley312
20 Apr 2012, 10:49 AM
We are evaluating Ext JS so are really new at using it. In fact, I am trying to build up my very first example. I *think* I am copying code correctly straight out of the examples, but I keep getting two errors... i never get to the "store created" line of code.

Warning: Store defined with no model
Error: Type error: 'undefined' is not an object.

The complete code is below... any clues appreciated as my trial only lasts 45 days :-)



Ext.require([
'Ext.container.Viewport',
'Ext.data.Model',
'Ext.data.Store'
]);

Ext.application({
name: 'HelloExt',
launch: function() {
console.log("app launch");
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
{
title: 'Hello Ext',
html : 'Hello! Welcome to Ext JS.'
}
]
});
Ext.define('Search', {
fields: ['id', 'query'],
extend: 'Ext.data.Model',
proxy: {
type: 'localstorage',
id : 'example-searches'
}
});
console.log("model defined");
var store = Ext.create('Ext.data.Store', { model: 'Search' });
console.log("store create");
store.load();
store.add({query: 'Sencha Touch'});
store.add({query: 'Ext JS'});
store.sync();
}
});

scottmartin
20 Apr 2012, 12:28 PM
I did not see any errors. Using 4.1RC3

34329

Scott.

pconley312
20 Apr 2012, 2:36 PM
When I change from using ext-debug.js to ext-all-debug.js the error messages went away. I guess I will stick with "all" for now, but I can't say that it makes sense to me (yet) as I thought what I had read directed you away from all as being un-nescessarily large.

scottmartin
20 Apr 2012, 2:41 PM
I would recommend using all-debug for development. You can always create custom all if app size is an issue.

Regards,
Scott.