开发者

ExtJS 4 Problem with MVC concept

i'm trying to use the new MVC concept and therefore started witht the AccountManager Example (examples/simple). Everything works fine as far as I stick to the tutorial, but I tried to extend it a bit.

I define a border layout in 'Viewport.js' and assign a header component (views/Header.js) to 'north' and a tab-Panel (views/MainPanel.js) which contains the 'views/user/List.js' as a tab.

Until now everything is ok.

But now i added another store (Profiles.js) and model (Profile.js), changed the references in code to use profile-store instead of user-store. I also updated the column-definition, imports ('requires') and everything e开发者_如何学Gos that is relevant(at least i think so...).

When i run my app i get a js-error in Observable.js -> addManagedListener-> 'item is undefined' when he tries to invoce the on-method of 'item'.

At first i tried hard to find the mistake i made in the code but I could not find anything, so i started to play around a little bit and found out, that it works as soon as I rename the folder 'user' in views/ to 'profile' (of course i had to fix some references in code too).

Is this behavior a bug or is it volitional? If so can anybody please tell me how this is exactly working?

Thank you very much!


ExtJS looks for the Javascript files based on your model/view/controller declarations.

i.e. if in your tell your controller that you have a store called Profile (via the stores attribute) by default, it is going to look for a file at app_name/stores/Profile.js


The problem was that i had to give my controller a reference to the store and the model. I didn't do that from the beginning, after my controller had a reference to the view, the view had a reference to the store and the store had a reference to the model. So I assumed everything is ok.

But it seems to be mandatory to provide this information redundant as far as understand and i can live with that...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜