weird behavior of MarionetteJS compositeView

家住魔仙堡 提交于 2019-12-11 01:25:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!