如何在Umbraco自定义部分中实现移动和排序

时间:2013-02-03 17:14:10

标签: umbraco custom-component

我创建了两个自定义部分,用于从外部(非umbraco)表填充树。我已经创建了ITaskReturnUrl的实现来处理节点的创建和删除 - 这很好。如何使其与菜单操作一起使用:排序和移动?

我已将相应的操作添加到节点的菜单中,但是当我单击该操作时出现此错误:

No node exists with id '1'

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: No node exists with id '1'

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[ArgumentException: No node exists with id '1']
   umbraco.cms.businesslogic.CMSNode.setupNode() +239
   umbraco.cms.businesslogic.CMSNode..ctor(Int32 Id) +36
   umbraco.dialogs.moveOrCopy.Page_Load(Object sender, EventArgs e) +1241
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   umbraco.BasePages.BasePage.OnLoad(EventArgs e) +14
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
  • 弗雷德里克

1 个答案:

答案 0 :(得分:1)

我决定用jquery-ui实现我自己的Sort-page。

要访问新页面,我创建了一个实现IAction-interface(full version)的新类:

public string JsFunctionName
{
   get
   {
      return "OpenSortWindow();";
   }
}

public string JsSource
{
   get { return "function OpenSortWindow(){ var node = UmbClientMgr.mainTree().getActionNode();UmbClientMgr.openModalWindow('/Umbraco/Dialogs/RaceNodeSort.aspx?id='+ node.nodeId, 'Sort items', true, 350, 380); }"; }
}

javascript打开一个新的对话框,我的aspx-side允许用户对元素进行排序。请注意,我使用UmbClientMgr.mainTree()。​​getActionNode()来获取当前节点并读取我插入到页面URL中的nodeId-property以将其传递给页面。

然后通过以下方法将此Action类插入上下文菜单:

courseNode.Menu.Add(new RaceSortAction());