Results 1 to 5 of 5

Thread: How can we create the same structure that Sencha cmd creates with view and models

  1. #1
    Sencha User
    Join Date
    Apr 2017
    Posts
    33
    Vote Rating
    0
      0  

    Default How can we create the same structure that Sencha cmd creates with view and models

    Dear All,

    When we use Sencha Cmd for a classic app creation and it creates many directories and sub directories to store the View, Model,Controller files.Actually that is taken care by Sencha cmd when we generate an app and it's a ALM tool. When we use only the fiddle where we don't have access to install Sencha trial versions at office, do we need to create the required folders manually to run an App ? Do we have any work around for that. Actually we are doing practice but it's time consume even simple School apps. Any comments will be much appreciated.

    Thanks

  2. #2
    Sencha User
    Join Date
    Oct 2016
    Posts
    28
    Answers
    1
    Vote Rating
    1
      0  

    Default

    Hello,

    As far as I know, there is no solution to generate the fiddle files automatically. What you can do is to fork from an existing working application (one that resembles as much as possible with you desired app) and further develop from that.

  3. #3
    Sencha Premium User alexander.urban's Avatar
    Join Date
    Nov 2013
    Posts
    322
    Answers
    9
    Vote Rating
    50
      0  

    Default

    In fact, none of the folders or files is strictly required.

    You can fill the existing app.js file with inline definitions. If you add a store there (either before Ext.application or inside the launch function) you don't need other files, let alone a folder structure. E.g.

    Code:
    Ext.define('MyApp.store.Test',{
        ...
    });
    Ext.application({
        name : 'Fiddle',
    
    
        launch : function() {
            var store = Ext.create('MyApp.store.Test');
        }
    })
    or

    Code:
    Ext.application({
        name : 'Fiddle',
    
    
        launch : function() {
            Ext.define('MyApp.store.Test',{
                ...
            });
            var store = Ext.create('MyApp.store.Test');
        }
    })
    Or you can use flat naming. MyApp.store.Test is in app/store/Test.js, but MyApp.TestStore is in app/TestStore.js

    Of cource, once your project grows, you want to compartmentalize your files into stores, views and controllers, but for really small test projects, I usually define everything in a single file, or maybe two.

  4. #4
    Sencha User
    Join Date
    Apr 2017
    Posts
    33
    Vote Rating
    0
      0  

    Default

    Thank you and OKK.

    Then we do compartmentalize only for categorize the files as views, models and controllers right ?

    Also, As we can define a class inside the same Ext.application itself ?

    Which means creating a class using Ext.define , creating the object of the same class , can we also use the same class fields and methods of the class inside master class ? I will practice this too.

    Fiddle is fine but would be very helpful if it's like eclipse to open different files. Can we download the fiddle and make it as project ?

    Thanks
    Mohammed sardar

  5. #5
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,337
    Answers
    3993
    Vote Rating
    1486
      0  

    Default

    Fiddle isn't mean to be a development environment, it can serve as one but it's not designed to replace an editor/IDE for your project.

    As @alexander.urban says, Ext JS and Cmd do not require files be placed in any specific place, we only recommend it to give a common structure. Ext.Loader holds a mapping of namespace to filesystem location and can then build a path to a file you are requiring. To help with that mapping, Cmd iterates over a selected number of places to find these classes and where they live on filesystem.

    Since Fiddle is a web app, there is no Cmd so it can only work with the default Ext JS paths (Ext.app.Application will setup the path to app by default). This is why if you have Fiddle.view.Main at app/view/Main.js in fiddle (assuming you kept the name Fiddle in app.js), Ext JS knows exactly where to load it. If you tried loading Fiddle.foo.Bar it will attempt to load app/foo/Bar.js as it build that path.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Similar Threads

  1. Replies: 3
    Last Post: 26 Feb 2013, 5:07 AM
  2. Using custom file structure with sencha create
    By FoxMulder900 in forum Ext: Q&A
    Replies: 2
    Last Post: 11 Jan 2013, 5:11 AM
  3. How to create a master view in Sencha 2.0 ?
    By german.larrosa in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 4 Apr 2012, 8:44 AM
  4. sencha command create extjs 4.0.7 app structure
    By maneljn in forum Sencha Cmd
    Replies: 0
    Last Post: 30 Mar 2012, 9:40 AM

Posting Permissions

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