问题
I am working with MarionetteJS compositeView.
For some reason i am getting a recursive template behavior.
Usually the itemView's template is rendered within the itemViewContainer but for some reason instead of taking the itemView's template it takes it's own compositeView template.
it's not english but the behavior can be visually seen here:
http://www.codeforum.me/admin.html
Another thing is, I have it working perfectly on my localhost but the moment i upload it and try to run it from my hosting server it shows this weird behavior.
any idea?
回答1:
This happens when marionette can't find your itemView. For example, if you specify the itemView before you actually define it, it won't be found. When you don't specify an itemView ( or its not found), the default behavior kicks in, which is to use the same compositeView as the itemView, to create a recursive tree structure.
To fix this, define the itemView before using it in the compositeView declaration.
IV = Marionette.ItemView.extend({ /* ... */ });
CV = Marionette.CompositeView.extend({
itemView: IV,
// ...
});
来源:https://stackoverflow.com/questions/14541491/weird-behavior-of-marionettejs-compositeview