-
31 Jan 2013 2:08 PM #1
Unanswered: Simple Hello app breaks when adding a Store
Unanswered: Simple Hello app breaks when adding a Store
I have been working with Ext JS for only a couple of weeks. That being said, I have decades of software development experience in lots of languages, and this has been the most frustrating framework I have ever worked with. I would suggest Sencha go look at Adobe's Flash tutorials to get people started.
To illustrate my problem I built a simple Hello app, and like my other app, it also stops working when I add a Controller that includes a Store. Both IE9 debugger or Firefox firebug report nothing. I just get a blank page. If I comment out the Store assignment, things work. Can't do any apps without a Store so what's up?
I'm using eclipse Juno, Tomcat 7, Ext JS 4.1.1a, and used sencha cmd to build the structure.
Index.html
<!DOCTYPE html>
<html>
<head>
<title>Hello Ext</title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css">
<script type="text/javascript" src="ext/ext-debug.js"></script>
<script type="text/javascript" src="app/app.js"></script>
</head>
<body></body>
</html>
App:
Ext.require('Ext.container.Viewport');
Ext.application({
name : 'HelloExt',
controllers : ['myController'],
launch : function() {
Ext.create('Ext.container.Viewport', {
layout : 'fit',
items : [ {
title : 'Hello Ext',
html : 'Hello! Welcome to Ext JS.'
} ]
});
}
});
Controller:
Ext.define('HelloExt.controller.myController', {
extend: 'Ext.app.Controller',
stores: ['myStore'],
init: function() {
console.log('Initialized MetricList! This happens before the Application launch function is called');
}
});
Store:
Ext.define('HelloEx.store.myStore', {
extend : 'Ext.data.Store',
models : ['myModel'],
autoLoad: true
});
Capture.GIF
I hope somebody can help me figure out what I've done wrong.
-
31 Jan 2013 2:23 PM #2Sencha - Ext JS Dev Team
- Join Date
- Apr 2007
- Location
- Sydney, Australia
- Posts
- 15,103
- Vote Rating
- 97
- Answers
- 171
Also, the convention used in the framework is that class names are pascal, not camel cased.Code:Ext.define('HelloEx.store.myStore', {Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
31 Jan 2013 3:09 PM #3
-
1 Feb 2013 12:45 PM #4
There are three things here:
1) Typo in Store definition: HelloEx.store.myStore
2) There is no models config in Store API. It must be model it accepts only one model.
3) You must check the APIs thoroughly and refer sample code blocks before working with any languages...
Thanks,
Sriram


Reply With Quote