我正在尝试在表单中的数据源字段中创建一个简单的查找。
表格和相关表格是 BankAccountTable。
1.- 将新字段 BullCust(扩展 EDT CustAccount)和字段组添加到新扩展 BankAccountTable.MyExtension。
2.- 创建新的表单扩展 BankAccountTable.MyExtension 并向表单添加新组。
这工作正常。但现在我想要一个更简单的查找。在 Ax2012 中,我将覆盖 BankAccountTable\Datasources\BankAccountTable\BullCust\Lookup 方法,如下所示:
public void lookup(FormControl _formControl, str _filterStr)
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
SysTableLookup sysTableLookup;
sysTableLookup = SysTableLookup::newParameters(tableNum(ExcEC_DocuTypeTable), _formControl);
queryBuildDataSource = query.addDataSource(tableNum(CustTable));
sysTableLookup.addLookupField(fieldNum(CustTable, AccountNum));
sysTableLookup.addLookupField(fieldNum(CustTable, Party));
sysTableLookup.addLookupField(fieldNum(CustTable, RecId));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
在 Ax7 中,这不再起作用。尝试了这种方法(基于https://ievgensaxblog.wordpress.com/2016/05/01/ax-7-how-to-override-form-data-source-field-methods-without-overlaying/):
3.- 创建管理查找的类:
public class BullFormBankAccountTable_Handler
{
public static BullFormBankAccountTable_Handler construct()
{
return new BullFormBankAccountTable_Handler();
}
public void BankAccountTable_BullCust_OnLookup(FormDataObject _formDataObject, FormControl _formControl, str _filterStr)
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
SysTableLookup sysTableLookup;
sysTableLookup = SysTableLookup::newParameters(tableNum(BullDocuTypeTable), _formControl);
queryBuildDataSource = query.addDataSource(tableNum(CustTable));
sysTableLookup.addLookupField(fieldNum(CustTable, AccountNum));
sysTableLookup.addLookupField(fieldNum(CustTable, Party));
sysTableLookup.addLookupField(fieldNum(CustTable, RecId));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
}
4.- 创建订阅和链接适当事件的类扩展:
[ExtensionOf(formStr(BankAccountTable))]
final public class BullFormBankAccountTable_Extension
{
[FormDataSourceEventHandler(formDataSourceStr(BankAccountTable, BankAccountTable), FormDataSourceEventType::Initialized)]
public static void BankAccountTable_OnInitialized(FormDataSource _sender, FormDataSourceEventArgs _e)
{
var overrider = BullFormBankAccountTable_Handler::construct();
_sender.object(fieldNum(BankAccountTable, BullCust)).registerOverrideMethod(methodStr(FormDataObject, lookup),
methodStr(BullFormBankAccountTable_Handler, BankAccountTable_BullCust_OnLookup), overrider);
}
}
而且没有结果。我已经调试并正确调用了 BullFormBankAccountTable_Extension.BankAccountTable_OnInitialized()。但生成的查找是标准查找,而不是矿山查找。关于如何执行此操作的任何想法或示例?
(PS:版本Ax7平台更新9)