Results 1 to 2 of 2

Thread: Help adding a new class to an application

  1. #1
    Sencha User
    Join Date
    Aug 2015
    Posts
    25
    Answers
    7
    Vote Rating
    2
      0  

    Default Help adding a new class to an application

    I originally had my launch code in app.js for testing purposes, I'd like to move it to another folder in another file as a custom application.


    This is what app.js looks like now:


    Ext.application({
    name: 'MyApp',
    namespaces: 'MyApp',
    requires: 'MyApp.Service'
    });


    I'm only guessing this is what it should look like, based on many sources throughout the web. The official documentation isn't really clear on what needs to go there. It tells you what can go there, but I'm aiming for a minimum here.


    The code I want to link is currently located in Service.js as follows:


    app.js
    app/
    MyApp/
    Service.js


    Again, I'm only guessing this is the correct directory structure. The official documentation isn't really clear on how this should be set up. I have no problem changing this, adding directories, flattening, etc.


    Service.js looks like this:

    Ext.define('MyApp.Service', {
    extend: 'Ext.app.Application',
    launch: function () {
    // When the application is ready, set up
    Ext.onReady(this.setUp, this, {priority: -500});
    },
    setUp: function() {
    // Code here
    }
    });


    The code for "launch" and "setUp" was originally in app.js, where it worked okay. I'm guessing that this is how to define MyApp.Service, not really sure. The official documentation isn't really clear on what needs to go there. Again, it tells you what can go there, but that doesn't really help.


    Running the above I get a blank screen and a warning in console:


    [W] Missing namespace for MyApp.Service, please define it in namespaces property of your Application class.


    When it's building, I can see hints that it's pulling in Service.js code, but it's just not connecting to it.


    I've been hammering at this for hours now and I'm really at a loss as to what to do, any help would be appreciated.

  2. #2
    Sencha User yeghikyan's Avatar
    Join Date
    Mar 2009
    Location
    München
    Posts
    536
    Answers
    95
    Vote Rating
    42
      0  

    Default

    Ext.define('MyApp.MyApp.Service', {

    The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague.

Similar Threads

  1. Adding css class to grid row
    By Maskca in forum Community Discussion
    Replies: 4
    Last Post: 1 Aug 2017, 7:48 AM
  2. Ext.application class set wrong path for application namespace
    By nikolay.bobrovskiy in forum Ext 5: Bugs
    Replies: 2
    Last Post: 26 Mar 2015, 1:37 PM
  3. Should I extend Ext.app.Application class?
    By isobretatel in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 25 Sep 2012, 7:07 AM
  4. Adding a Class to DOM element
    By jbrown13 in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 11 Sep 2012, 10:19 AM
  5. Adding Class over the list
    By babar.sajjad in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 1 Feb 2011, 9:17 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •