Dynamics ax 窗体/数据源更新通知
在子窗体中定义updatecaller方法
void updateCaller() { Common common; Object dataSource; Object caller; ; //----------------------------------- // 数据源中代码 common = element.args().record(); if (common && common.isFormDataSource() && formDataSourceHasMethod(common.dataSource(), identifierstr(SomethingWasHappend))) { dataSource = common.dataSource(); dataSource.SomethingWasHappend(); } //----------------------------------- //----------------------------------- //窗体中代码 caller = element.args().caller(); if (caller && classidget(caller) == classnum(SysSetupFormRun) && formHasMethod(caller, identifierstr(SomethingWasHappend))) { caller.SomethingWasHappend(); } //----------------------------------- }
父窗体:
//窗体或者数据源方法
void SomethingWasHappend()
{
; info("SomethingWasHappend-窗体或数据源"); }
子窗体添加按钮,并添加方法:
void clicked() { super(); element.updateCaller(); }