简体   繁体   English

动态轴4.0,打开表格而不对当前记录应用过滤器

[英]Dynamics ax 4.0, opening form without applying filter on current record

I have form with VendTable grid for example, which has CustAccount field. 例如,我有VendTable网格的表单,其中包含CustAccount字段。

I want to place button, click on which will open CustTable form where all customers are visible. 我想放置按钮,单击将打开CustTable表单,其中所有客户都可见。

If I just put CustTable menuitem, then clicking on it will open CustTable form, but in this form only one record is displayed - one that has the same AccountNum as in vendTable.CustAccount. 如果我只是放置CustTable menuitem,然后单击它将打开CustTable表单,但在此表单中只显示一条记录 - 一条记录与vendTable.CustAccount中的AccountNum相同。

How to open whole custTable? 如何打开整个custTable? Is there better solution than create button, and then use ClassFactory::FormRunOnClient to display form? 是否有比创建按钮更好的解决方案,然后使用ClassFactory :: FormRunOnClient来显示表单?

PS. PS。 I need button, so RMB->"Go to the Main Table Form" doesn't count. 我需要按钮,所以RMB - >“转到主表格”不计算在内。

The problem is that the VendTable record is applied as an argument to the CustTable form, which then creates a dynalink. 问题是VendTable记录作为参数应用于CustTable表单,然后创建一个dynalink。 The solution is to avoid the argument. 解决方案是避免争论。

Override the clicked method in the CustTable display menu item like this: 覆盖CustTable显示菜单项中clicked方法,如下所示:

void clicked()
{
    this.menufunction().run(new Args(element));
}

This calls the CustTable form with the caller object only and without the record argument. 这仅使用调用者对象调用CustTable表单,而不使用record参数。

I know this is a fairly old question but if someone comes here looking for the answer, just call method clearDynalinks() on the object QueryBuildDataSource. 我知道这是一个相当古老的问题,但如果有人来这里寻找答案,只需在对象QueryBuildDataSource上调用方法clearDynalinks()

For example, you have created a Form and it is automatically filtering your Datasource because of the Dynalinks that Dynamics creates automatically, you solve it by putting the following code inside the init() method, on your form Datasource: 例如,您创建了一个表单,它会自动过滤您的数据源,因为Dynamics会自动创建动态数据源,您可以通过将以下代码放在init()方法内的表单数据源上来解决它:

QueryBuildDatasource qbds;
;


qbds = this.query().dataSourceTable(tablenum(MyTableName));
qbds.clearDynalinks();

// Next line is optional, it clears initial ranges
qbds.clearRanges();

// if you need to add any ranges you can do it right after you clear the initial dynalinks / ranges

Hope it helps... 希望能帮助到你...

You have 2 options, you can either create a button and override its clicked() method, or use a MenuItemButton and assign an Action MenuItem to it. 您有2个选项,您可以创建一个按钮并覆盖其clicked()方法,或使用MenuItemButton并为其分配一个Action MenuItem。

Using MenuItems is a best practice, because it allows you to use the AX security & configuration framework. 使用MenuItems是一种最佳实践,因为它允许您使用AX安全性和配置框架。 You can associate a class to the MenuItem and in the class' main() method you can run the FormRunOnClient() stuff as needed. 您可以将类与MenuItem相关联,在类'main()方法中,您可以根据需要运行FormRunOnClient()。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM