How to refresh datasource args caller[X++]
To refresh datasource args caller, you must add override method close on form
like source code below :
public void close() { FormRun callerForm; ; callerForm = element.args().caller(); callerForm.dataSource().reread(); // callerForm.dataSource().refresh();
// -1 means refresh all records, the default is -2 which refreshes only certain specific records (eg marked)
callerForm.dataSource().refreshEx();
super(); }
common = args.record(); if (common.isFormDataSource()) { formDataSource = common.dataSource(); formDataSource.formRun().lock(); formDataSource.reread(); formDataSource.refreshEx(); formDataSource.active(); formDataSource.formRun().unLock(); }
AX2012
_dataSource.reread();
trvExpTable_1_ds.research(true);
cancel button
void clicked() { trvExpTable trvExpTable; ; if( !element.THK_validateCancel(trvExpTable_1_ds, #TrvTableSelected))//1 return; TrvPost::THK_cancelMultiple(trvExpTable_1_ds); trvExpTable_1_ds.research(true); }
process class
// VAR Changed on 10/12/2013 at 15:09:27 by THK7519 WO-PG020 public static void THK_cancelMultiple(FormDataSource _formDataSource, boolean _selectedAll = false) { trvExpTable buffer; trvExpTable trvExpTable; ; if(_formDataSource.table() != tableNum(trvExpTable)) return; ttsBegin; if(!_selectedAll) { for (buffer = _formDataSource.getFirst(true) ? _formDataSource.getFirst(true) : _formDataSource.cursor(); buffer; buffer = _formDataSource.getNext()) { trvExpTable = trvExpTable::find(buffer.ExpNumber, true); if(trvExpTable) { trvExpTable.THK_PostStatus = THK_PostStatus::Cancelled; trvExpTable.update(); } } } else // Post everything that's visible in the GRID { buffer = _formDataSource.getFirst(); while(buffer) { trvExpTable = trvExpTable::find(buffer.ExpNumber, true); if(trvExpTable) { trvExpTable.THK_PostStatus = THK_PostStatus::Cancelled; trvExpTable.update(); } buffer = _formDataSource.getNext(); } } ttsCommit; _formDataSource.reread(); }