导航后木偶视图未关闭

时间:2015-05-14 14:46:53

标签: javascript backbone.js model-view-controller marionette

我们有几种类型的标签,但它们属于同一数据集。我们的系列设置类似于此

api/tags.json?category=state

我们的牵线木偶结构如下:

  1:Select Tag Category (LayoutView)
   2:[Category:State,Type,Product,Company] Tags List (CompositeView)
    3:Add / Edit [Category] Tag (ItemView)

问题是,如果我们在一个类别的第三级或第二级,选择第一级,并导航到不同类别的标签,前一个集合仍然存在。如果您继续进行添加/修改,它也是如此,它也会保留旧模型。

如果有什么问题让我知道,但我认为这解释了我的问题。任何指针/建议将不胜感激。

编辑:添加了控制器/路由器

        DocRepoTags:function(category) {
            this.reloadHeader({'title': 'Document Repository', 'subnav': subnav(docRepoMenu)});
            App.mainRegion.destroy();
            App.mainRegion.show(new DocRepoTagsView({category:category}));
        },
        DocRepoTagsCategory:function() {
            this.reloadHeader({'title': 'Document Repository', 'subnav': subnav(docRepoMenu)});
            App.mainRegion.destroy();
            App.mainRegion.show(new DocRepoTagsCategoryView());
        },
        DocRepoTagsAdd:function(category) {
            this.reloadHeader({'title': 'Document Repository', 'subnav': subnav(docRepoMenu)});
            App.mainRegion.destroy();
            App.mainRegion.show(new DocRepoModifyTagsView({category:category}));
        },
        DocRepoTagsEdit:function(category, key) {
            this.reloadHeader({'title': 'Document Repository', 'subnav': subnav(docRepoMenu)});
            App.mainRegion.destroy();
            App.mainRegion.show(new DocRepoModifyTagsView({category:category, key:key}));
        }

接下来是路线:

'doc-repo/tags': 'DocRepoTagsCategory',
'doc-repo/tags/:category': 'DocRepoTags',
'doc-repo/tags/:category/add': 'DocRepoTagsAdd',
'doc-repo/tags/:category/edit/:id': 'DocRepoTagsEdit'

0 个答案:

没有答案
相关问题