1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    2
    Vote Rating
    0
    beammeupscotty is on a distinguished road

      0  

    Default 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.

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,949
    Answers
    461
    Vote Rating
    636
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Code:
    Ext.define('HelloEx.store.myStore', {
    Also, the convention used in the framework is that class names are pascal, not camel cased.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Jan 2013
    Posts
    2
    Vote Rating
    0
    beammeupscotty is on a distinguished road

      0  

    Default


    Quote Originally Posted by evant View Post
    Code:
    Ext.define('HelloEx.store.myStore', {
    Also, the convention used in the framework is that class names are pascal, not camel cased.
    Believe it or not my real app had a typo in the domain too. Also I copied all the stuff that the sencha cmd created, fixed cases etc. and it worked. Sometimes you really need another set of eyes.

  4. #4
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    42
    Answers
    6
    Vote Rating
    2
    sriram139 is on a distinguished road

      0  

    Default


    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

Thread Participants: 2

Tags for this Thread