deftjs / DeftJS5

Deft JS for Ext JS 5
MIT License
34 stars 13 forks source link

Compile Issue #7

Closed bardiakhosravi closed 10 years ago

bardiakhosravi commented 10 years ago

Hi,

I am trying to get deftjs work with a plane project. I have added deftjs as a package and have added it to the requires config in app.js. When I build my app i get the following error:

[ERR] C2008: Requirement had no matching files (data.controller) -- .../packages/deft/src/js/mixin/Controllable.js:95:1

any help in resolving this issue is appreciated

Cheers.

brian428 commented 10 years ago

With the preparation for the switch back to using mixins, you'll need to require the Injectable and Controllable mixins somewhere in your application. In Deft 5, you'll have to use the mixins, since Sencha has marked class preprocessors as private.

I'll add a note to the docs somewhere to help explain this.

brian428 commented 10 years ago

Actually, no. This is true of the Injectable mixin, but the Controllable mixin has been completely removed. It isn't used any longer because all the view controller logic is now handled by Ext JS itself. So I'd probably need to see what you're doing to try and figure out what is complaining about the lack of the Controllable mixin. A search of the Deft 5 codebase doesn't find any uses of this class any longer.

bardiakhosravi commented 10 years ago

Thanks for the quick reply.

I am actually requiring the two files in my app.js. Here is how my app.js looks like.

Ext.Loader.setConfig({
    enabled: true,
    paths: {
        'Ext': '../ext/src',
        'Deft': '../packages/deft/src/js',
        'MyAppName': 'app'
    }
});

Ext.syncRequire(['Deft.mixin.Injectable', 'Deft.mixin.Controllable']);

Ext.application({
    name: 'MyAppName',

    extend: 'MyAppName.Application',

    autoCreateViewport: 'MyAppName.view.main.Viewport'  
});

I still get the error. A note that I was using this setup for deftjs 0.9.0 and sencha 4+ and it worked.

brian428 commented 10 years ago

Right. Again, now that Ext JS itself handles creation of view controllers, the Deft JS Controllable mixin has no purpose any longer, so it has been removed. So you're trying to require a file that doesn't exist any longer. You'll need to remove this from your syncRequire().

brian428 commented 10 years ago

To add, we'll obviously be migrating and updating the Deft documentation for Deft JS 5. We just haven't done this yet because we're still finalizing the official Deft JS 5.0 release.

bardiakhosravi commented 10 years ago

I see. But I am still a bit confused since you mentioned that I have to require the two mixins but you also mentioned (as I also see in the source) that the two mixins are deprecated. Were you under the impression that I am using ExtJs 4 with Deft 0.9.0? When I remove the syncRequire I still get the error when I build.

Should I be waiting for the release fine release of Deft JS 5.0?

do you have goal on release date of DeftJS 5? we heavily rely on DeftJS (the awesome lib that it is) in our project and we are trying to move ExtJs 5.

brian428 commented 10 years ago

In Deft 5, the Injectable mixin must be used for classes that want to participate in dependency injection. It's listed in the requires block of Deft.mvc.ViewController.

In Deft 5, the Controllable mixin has been removed, because Ext JS itself now handles creating view controllers.

Nothing in the Deft 5 code references the Controllable mixin any longer. So if you're getting an error in your project related to the Controllable mixin, you must have something in your application code that is trying to reference this class somewhere.

Make sense?

bardiakhosravi commented 10 years ago

So I fixed my issue by deleting the Controllable.js mixin from the source of Deft JS. now I can build and dont get any build errors, however when I run my application which is currently just a Viewport with a text field inside and controller for the viewport just extends Deft.mvc.ViewController I get this error when I run the app

screen shot 2014-07-21 at 12 52 13 pm

this is my view code:

Ext.define('Kloud.view.main.Viewport', {

    extend: 'Ext.container.Container',

    requires:[
        'Ext.layout.container.Fit',
        'Ext.form.field.Text',
        'Kloud.view.main.ViewportViewController'
    ],

    controller: 'ViewportViewController',

    layout: 'fit',

    initComponent: function() {
        Ext.applyIf(this, {
            items: [
                {
                    xtype: 'textfield',
                    fieldLabel: 'test',
                    text: 'test'
                }
            ]
        });

        return this.callParent(arguments);
    }

});

and my controller code:

Ext.define('Kloud.view.main.ViewportViewController', {

    extend: 'Deft.mvc.ViewController',

    requires: [
        'Deft.mvc.ViewController',
        'Deft.Deferred',
        'Deft.Promise',
        'Deft.mvc.ViewController'
    ],

    alias: 'controller.ViewportViewController',

    init: function() {
        console.log("view controller");
        Ext.create('Deft.Deferred'); // just to make sure i have access to Deft
        return this.callParent(arguments);
    }
});
bardiakhosravi commented 10 years ago

Note that if I extend Ext.app.ViewController things are ok!

PS. please let me know if I should move this to a new thread

brian428 commented 10 years ago

I'd recommend posting to the mailing list. An issue ticket isn't really the place for ongoing help requests.

Also, it sounds to me like you're not using Deft JS 5. If you had a Controllable.js file locally, then you're doing something wrong or using the wrong version, because Deft 5 has no Controllable mixin. (See https://github.com/deftjs/DeftJS5/tree/develop/packages/deft/src/coffee/mixin).

bardiakhosravi commented 10 years ago

wow you are right. I downloaded the source manually as oppose to using sencha command line and things are good now.

Thanks a lot for helping me through this and replying so quickly.

brian428 commented 10 years ago

Ah, yes, Deft 5 isn't part of the Sencha package repository yet (since it isn't final yet).