我正在使用一个复合视图,其中$ .dialog调用了它的$ el.
然后,合成视图将列出集合中的项目.
现在我已经尝试了多种方式来渲染集合项:从复合视图外部获取它,然后将其附加到视图中,在视图内部获取,从我的服务器脚本预加载集合等等...
一切似乎都有效,但同样的问题发生..
一旦复合视图看到这个集合,它就会再次调用它自己的初始化函数......
我完全理解渲染函数将在集合重置或添加时调用...但是初始化??? 我完全不知道为什么会这样.
showCustomFieldSelect: function(e){
log('triggered');
e.preventDefault();
var cl = new AustApp.Collections.CustomField;
var select = new AustApp.Views.AvailableCustomFieldsList({
el: "#available-custom-fields-popup",
collection: cl
});
cl.fetch();
cl.once("reset", function(){
// this bind was
// previously used for creating the view
// or calling render functions directly
// amongst numerous efforts to debug
}, this);
},
MyApp.Views.AvailableCustomFieldsList = function(){
var AvailableCustomFieldsList = Backbone.Marionette.CompositeView.extend({
template: "#available-contact-list-custom-field-list-js",
tag: "div",
itemView: AustApp.Views.AvailableCustomFieldsListItem,
emptyView: AustApp.Views.EmptyAvailableCustomFieldsListItem,
itemViewContainer: "ul",
templateHelpers: viewHelpers,
initialize: function(){
log('init called'); …Run Code Online (Sandbox Code Playgroud) 我正在学习ZF2并计划申请.
我想有1个应用程序与几组模块.每组模块最多可包含20多个模块.
我无法保证整个应用程序的任何模块的唯一名称,但我可以保证他们在模块组中的唯一性.
理想情况下使用Hosting路由器将请求路由到模块组.
例如 http://admin.mysite.com/foo/ =>'Admin/Foo/Index/Index',
http://special.mysite.com/foo/ =>'Special/Foo/Index/Index'
想法#1
我希望为每个模块组使用不同的module_path,并为模块组周围的模块路径命名空间,以确定模块类的唯一性.但发送到module_autoloader的模块似乎只关注传递的任何字符串的第一部分.
例如
array('modules' => array(
'Admin\Admin','Admin\Bob','Admin\Users'
));
Run Code Online (Sandbox Code Playgroud)
这是我不明白的奇怪行为:
我已经设法通过对templateInjecter的一些小改动来解决这个问题,但它似乎很乱.
想法#2
只需将模块名称添加到其子目录中,例如
namespace AdminAdmin\Controller,
class IndexController {}
Run Code Online (Sandbox Code Playgroud)
思考
题: