【问题标题】:Umbraco 7: How can I refresh the tree view in my custom section?Umbraco 7:如何刷新自定义部分中的树视图?
【发布时间】:2014-11-17 21:06:00
【问题描述】:

我在 umbraco 中创建了一个自定义部分来管理 SQL 数据库中的一些数据。

我可以编辑项目,但添加时我需要刷新页面才能在左侧的自定义树中看到我的新行。

如何使用 AngularJS 刷新我的自定义树?我的树被称为“客户”。

我已尝试调试代码并查看源代码以找到事件,但我似乎无法弄清楚如何去做。

有什么方法可以调用umbTreeDirective 吗?还是要订阅的事件?

我对 AngularJS 还很陌生,有点挣扎。

【问题讨论】:

    标签: javascript angularjs umbraco7


    【解决方案1】:

    您正在寻找navigationService。

    这一行是一个同步树调用的例子:

    navigationService.syncTree({ tree: 'clients', path: content.path, forceReload: false, activate: true });

    这是一个做作的意大利面条承诺但完整的例子:

    angular.module("umbraco")
    .directive('nowplaying', ['navigationService', 'contentResource', 'contentEditingHelper', function (navigationService, contentResource, contentEditingHelper) {
    
                    //spaghetti example to create new document
                    contentResource.getScaffold(parentId, alias)
                    .then(function (scaffold) {
                        var myDoc = scaffold;
                        myDoc.name = name;
    
                        //we have minimum to publish
                        contentResource.publish(myDoc, true, [''])
                            .then(function (content) { 
                                $scope.newlyCreatedNode = content;  
    
                                    //Sync ('refresh') the tree!
                                    navigationService.syncTree({ tree: 'clients', path: content.path, forceReload: false, activate: true });
    
                        });
                    });
    }]);
    

    所有Belle documentation lives here。 - 我不确定它是否得到积极维护,我可以肯定地说,自从它首次发布以来,一两个签名已经发生了变化。除此之外,它是我所知道的与所有 umbraco 暴露的模块和服务交互的最佳资源。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-16
      • 2015-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多