【问题标题】:AX7: Creating a method on a View using the extension method (bug?)AX7:使用扩展方法在视图上创建方法(错误?)
【发布时间】:2016-09-06 19:05:14
【问题描述】:

编辑:问题是,为什么view 上的显示方法不起作用?

我正在尝试使用扩展方法在DirPartyPostalAddressView 上创建显示方法,据我所知,这可能是AX7 错误或者我做错了。我在最新的 AX7 上,最近更新。

我正在使用这里详述的方法https://blogs.msdn.microsoft.com/mfp/2015/12/15/x-in-ax7-extension-methods/

我创建了一个概念证明display method 用于视图DirPartyPostalAddressView 与表CustTable 以显示可能的bug

扩展类代码:

static class MyClass_extension
{
    public static display NoYesId displayYesDirPartyPostalAddressView (DirPartyPostalAddressView _this)
    {
        return NoYes::Yes;
    }

    public static display NoYesId displayYesCustTable (CustTable _this)
    {
        return NoYes::Yes;
    }
}

我创建了CustTable 形式的扩展,向其添加了一个复选框控件,设置了DataSource = CustTableDataMethod = MyClass_extension::displayYesCustTable,这可以正常工作。 (见截图)

问题:我创建了LogisticsPostalAddressGrid 表单的扩展,在网格中添加了一个复选框控件,设置了DataSource = DirPartyPostalAddressView,但它无法编译。 (见截图)

错误是:

The data method 'MyClass_extension::displayYesDirPartyPostalAddressView' was not found on the data source 'DirPartyPostalAddressView' or its base table/view.

【问题讨论】:

  • 你的问题是什么?
  • 为什么view上的显示方法不起作用?

标签: axapta x++ dynamics-ax7 d3fo


【解决方案1】:

【讨论】:

    【解决方案2】:

    我认为你应该在视图上使用计算列而忘记那里的显示方法。

    查看 AX 帮助 Wiki 中的 this。我猜为了测试目的,如果在计算列的方法中你只是“返回'1'”或“返回真”就足够了。

    【讨论】:

    • 它正在返回一个符号(图标/图片)。我只是把这个例子简单化为 POC 失败。我会看看这个,看看我是否可以摆脱计算列。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多