2

Is there someone here who made a MVC application using EXTJS 4 BETA 3? and works fine?? please help me how?, ..

I have followed step by step here .. and @Abdel Olakara help

but there is still an error ... here my firebug

[Ext.Loader] Synchronously loading 'AM.controller.Users'; consider adding  
Ext.require('AM.controller.Users') above Ext.onReady  

[Ext.Loader] Synchronously loading 'AM.store.Users'; consider adding  
Ext.require('AM.store.Users') above Ext.onReady

this.getView('Viewport') is null

When i read this at the forum ... there are still some bug with MVC guide ...

so, if you ever make it works.. how?

this is my Application.js :

Ext.Loader.setConfig({enabled:true}); 
Ext.create('Ext.app.Application', {
    name: 'AM',

    controllers: [
        'Users'
    ],

    views: [
        'user.List'
    ],

    launch: function() {
        Ext.create('Ext.container.Viewport', {
            layout: 'fit',
            items: {
                xtype: 'userlist'
            }
        });
    }
});

i'm trying to learn MVC in Extjs... sorry if my english bad..

Egy Mohammad Erdin
  • 3,402
  • 6
  • 33
  • 57
  • 1
    the MVC features are still not ready.. You will have to wait for Ext JS dev team to release it completely with all bug fixes and proper documentations. – Abdel Raoof Olakara Apr 19 '11 at 09:33

2 Answers2

4

Well, I think I should take back my words! I had some success after going through sencha blog. And finally, got my MVC "Skeleton" running!

Here is the working code:

Ext.Loader.setConfig({enabled:true});
Ext.create('Ext.app.Application', {
    name: 'AM',
    autoCreateViewport: false,
    controllers: [],

    launch: function() {
        Ext.create('Ext.container.Viewport', {
            layout: 'fit',
            items: [
                {
                    xtype: 'panel',
                    title: 'Users',
                    html : 'List of users will go here'
                }
            ]
        });
    }
}); 

Please note that, the code is very minimal and have removed the common errors reported in forums and here. The next step would be to start playing with this code and add controllers, views etc onto it!

I will keep updating this answer going forward.


Update: The first two error mentioned are not actually errors. They are warnings and application works fine even if they display these warnings. The third error you mentioned is a stopper!

Solution to Viewport problem Here are two ways to solve it.

  1. Use the autoCreateViewport: false, property and define your viewport (I see that you have defined your viewport in launch method)
  2. Create a Viewport.js and save it in view folder. In this case, I felt my launch method empty and moved the viewport code to Viewport.js file. But I do get an error:

    Uncaught TypeError: Cannot call method 'create' of null

Abdel Raoof Olakara
  • 19,223
  • 11
  • 88
  • 133
  • Ext.Loader.setConfig({enabled:true}); is what i'm looking for... "I had some success after going through sencha blog. And finally, got my MVC 'Skeleton' running! " which one thread?? can give me the link?? – Egy Mohammad Erdin Apr 19 '11 at 16:10
  • actually i still get error `this.getView("Viewport") is null`, like this: http://www.sencha.com/forum/showthread.php?130257-Beta3-API-Doc-Issues&p=591682&viewfull=1#post591682 ..... now i am trying so hard to fix it' – Egy Mohammad Erdin Apr 19 '11 at 16:17
  • well.. no error for me.. can you post your latest code by editing the question? – Abdel Raoof Olakara Apr 19 '11 at 17:28
  • all script?? or just the `Applicatition.js` ?? i think nothing different with all script here: http://dev.sencha.com/deploy/ext-4.0-beta3/docs/guide/application_architecture.html .. but just for make sure i'll edit my question with my last `Application.js` – Egy Mohammad Erdin Apr 19 '11 at 17:37
  • +1 @Abdel, great... now all works for me... but the warning part is really annoying... it's like that we make an app not in Ext4-ish.. – Egy Mohammad Erdin Apr 20 '11 at 06:59
  • @Ebo, we will have to wait for next release from Sencha... We are few hours away from the weekly release.. – Abdel Raoof Olakara Apr 20 '11 at 07:04
0

I do use ExtJS 4.1.

In my code [Ext.Loader] Synchronously loading 'OOO.store.News'; consider adding
Ext.require('OOO.store.News') above Ext.onReady
warning message was invoked if I place

stores: [
    'News',
],

in my app/Application.js file instead of app/controller/OOO.js file.

So put stores:[], in controller file.

s.webbandit
  • 16,332
  • 16
  • 58
  • 82