PDA

View Full Version : Support for Ext.app.Controller models/stores/views



Dev@QLP
12 Oct 2015, 9:16 AM
Maybe I have something configured incorrectly, but should the plugin be able to resolve the "models/stores/views" array config with the correct class? I'm getting the following warning: "Unknown store lead.LeadDetail".. etc.




Ext.define('LDB.controller.common.Lead', {
extend: 'Ext.app.Controller',
stores: [
'lead.LeadDetail'
],
views: [
'customer.email.EmailWindow'
]
});


The full class paths being: LDB.store.lead.LeadDetail and LDB.view.customer.email.EmailWindow.

Mark.Brocato
13 Oct 2015, 8:57 AM
You're right, they should be resolved, and my tests show that working correctly locally. Can you provide some more info about your environment? Specifically:

What version of Ext JS/Touch are you using?
If Ext JS 6, is your app universal, or configured for a single toolkit?
Where do the classes you mentioned reside in the directory structure?
What version of the plugin do you have installed?

Dev@QLP
13 Oct 2015, 9:38 AM
I'm using ExtJS 5.1.1 and Plugin version 6.0.3.430. Also I'm using Webstorm 10.0.4. I added the ExtJS library under "Languages & Frameworks -> Javascript -> Libraries". I can see that most of the plugin features are working correctly... I.E. auto-suggest missing requires statements and such just for some reason these Controller shortcut configs aren't being matched up correctly.

I have a normal directory structure I believe:


my_app
app.js
app.scss
index.html
app
Application.js
controller
common
Lead.js
model
store
lead
LeadDetail.js
view

Mark.Brocato
13 Oct 2015, 12:13 PM
You only have to add a JavaScript library if the Ext JS source code is outside of your project. Just curious, is that actually the case? For apps built with cmd the Ext JS source is generally in an directory named "ext" which is a peer to the "app" directory.

Mark.Brocato
13 Oct 2015, 12:20 PM
Also, if you try to add another item to the views array in your controller and bring up completions using ctrl-space, do your view classes appear in the popup menu?

Mark.Brocato
13 Oct 2015, 12:25 PM
Lastly, can you verify that you've got an app.json file in the same root folder as app.js. Does the app.json file have a name property? Would you be able to post it so I could take a look?

If your app.json file is missing, you can just add a trivial one to make the plugin work properly. All it needs is something like:



{ "name" : "MyAppName" }

Dev@QLP
13 Oct 2015, 12:39 PM
You only have to add a JavaScript library if the Ext JS source code is outside of your project. Just curious, is that actually the case? For apps built with cmd the Ext JS source is generally in an directory named "ext" which is a peer to the "app" directory.

Yeah, we have a weird process where when we want to do a build, we copy over all the src files into the actual ext workspaces for sencha command and then run the sencha app build commands. This is so we can keep the src code seperate from all the sencha command build artifacts. Therefore I had to add the Javascript library.

Dev@QLP
13 Oct 2015, 12:41 PM
Lastly, can you verify that you've got an app.json file in the same root folder as app.js. Does the app.json file have a name property? Would you be able to post it so I could take a look?

If your app.json file is missing, you can just add a trivial one to make the plugin work properly. All it needs is something like:



{ "name" : "MyAppName" }


Ah ok, looks like this was the issue. I didn't realize the app.json was required. When I copied it over to our "src" directory, it recognized all the views correctly. I assumed it would grab the app name from the "Application.js" file. All good now I think. Thanks! :D

Dev@QLP
13 Oct 2015, 1:03 PM
Mark,
Maybe I should start another post but it looks like the plugin doesn't catch out "common" code package. I assume this is because we would have to use Sencha CMD "packages" instead of using the workspace.classpath method that we currently use detailed here (http://docs.sencha.com/cmd/5.x/workspaces.html).

For example, our app name = LDB but our common package code namespace is QLP. However there isn't anywhere in the app.json to put the "QLP" namespace.

Thanks,
Tim