n00b question: how to add to Ex.application "requires" section?
So I've followed the "First Touch Application" tutorial, and get pretty much nothing on screen, other than the header.
Chrome reports this error:
"Uncaught TypeError: Cannot call method 'setStore' of undefined"
Comparing my work to the "CityBars670" sample download, I see the sample has this section under the code for "Application":
whereas my app is missing that.
I can't simply type it in to add it ... can someone please tell me, step by step, how I go about adding this "requires" section to my app?
Sorry if this is a complete n00b question ... learning this stuff at 5am, so maybe my head isn't screwed on properly ;-)
Click the application node in the inspector; in the configuration grid at the bottom right search for "requires" then add any particular requires you want.
Thanks so much for that Aaron.
I was sure I had tried that, but the filter wasn't returning the "requires" configuration item. Obviously I was doing something wrong ... probably had the wrong item selected in the Inspector.
All fixed now. Ended up getting my version of the CityBars sample project up and running, after a few more fixes related to id casings, so all good!
One more question on this subject ... how would I know what/when to add to the "requires" section?
There's nothing about modifying that section in the walkthrough for the CityBars sample application ... if it wasn't for doing a line-by-line comparison to the existing working demo download, I never would have realised I needed those entries.
I had assumed that by adding the components to the designer surface, the necessary "requires" would be automagically populated. Not the case?
Requires are typically added automatically. Sometimes this doesn't always work though.
Is there a list/guide somewhere, that says "if you use THIS component, then you should have THIS requires"? In case another "doesn't always work" situation arises?
I'm flying blind ... if this hadn't been demo code that I could compare to a pre-built example, I would have been buggered trying to work out what the problem was.
Requires are simple but seemingly hard to explain.
A few examples:
If a store uses a particular model then it would need to require that model to be loaded before it's defined.
If you have a view that instantiates another view by name or xtype then you'd need to require it.
In general, the framework should do a good job telling you that files we're loaded in the correct order if you do it wrong.
Application requires are slightly different in that it says here's all my stuff. It's up to you if you want to require only top level classes and have them require what they need or simply require everything.
Tags for this Thread