gpt4 book ai didi

javascript - 暗影 7 : How can I refresh the tree view in my custom section?

转载 作者:行者123 更新时间:2023-11-29 10:13:56 29 4
gpt4 key购买 nike

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

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

如何使用 AngularJS 刷新我的自定义树?我的树叫做“客户”。

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

有什么方法可以在 umbTreeDirective 上调用吗?或者要订阅的事件?

我是 AngularJS 的新手,有点吃力。

最佳答案

您正在寻找 navigationService .

此行是 syncTree 调用的示例:

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

这是一个人为的、通心粉 promise 但完整的例子:

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 公开模块和服务交互的最佳资源。

关于javascript - 暗影 7 : How can I refresh the tree view in my custom section?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26981964/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com