如何在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
  • 弗雷德里克

我决定用jquery ui实现我自己的排序页面。

为了到达新页面,我创建了一个实现IAction接口的新类(完整版本):

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面的新对话框,用户可以对元素进行排序。请注意,我使用UmbClientMgr.mainTree().getActionNode()来获取当前节点,并读取我插入到页面URL中的nodeId属性,以将其传递到页面。

该Action类随后通过以下方式插入上下文菜单:

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

最新更新