相关疑难解决方法(0)

将自定义操作添加到扩展中的“操作”下拉列表

我正在尝试将我的自定义操作之一添加到 SOOrder 页面中现有的操作下拉列表中。我的代码定义如下:

public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
    public PXAction<PX.Objects.SO.SOOrder> customAction;

    [PXButton(CommitChanges = true)]
    [PXUIField(DisplayName = "Custom Action Title")]
    protected void CustomAction()
    {
        //stuff
    }

    public SOOrderEntry_Extension()
    {
       Base.action.AddMenuAction(customAction);
    }
}
Run Code Online (Sandbox Code Playgroud)

这样做会给我一个空对象引用错误。我接下来尝试定义我自己的动作列表如下:

public PXAction<PX.Objects.SO.SOOrder> ActionsMenu;
[PXButton]
[PXUIField(DisplayName = "Actions")]
protected virtual void actionsMenu()
{
}
Run Code Online (Sandbox Code Playgroud)

我也尝试使用

this.ActionsMenu.AddMenuAction(customAction) 
Run Code Online (Sandbox Code Playgroud)

但我再次得到了相同的空引用。我还尝试了以下代码:

public SOOrderEntry_Extension()
{
   Base.action.MenuAutoOpen = true;
}
Run Code Online (Sandbox Code Playgroud)

只是为了看看会发生什么并且也得到了相同的空引用错误:

[NullReferenceException:未将对象引用设置为对象的实例。]

编辑:Stackoverflow 不允许我在块引用中包含以下部分,因为它类似于代码。如果有人可以解决这个问题,那就去吧。

   PX.Data.PXGraph.CreateInstance(Type graphType, String prefix) +529
   PX.Web.UI.PXBaseDataSource.InstantiateDataGraph(Type type) +20
   PX.Web.UI.PXBaseDataSource.f(Type A_0) +400
   PX.Web.UI.PXBaseDataSource.g(Type A_0) +146
   PX.Web.UI.PXBaseDataSource.get_DataGraph() +302
   PX.Web.UI.PXBaseDataSource.k() +188
   PX.Web.UI.PXBaseDataSource.GetCommands() +69 …
Run Code Online (Sandbox Code Playgroud)

acumatica

1
推荐指数
1
解决办法
585
查看次数

标签 统计

acumatica ×1