Acumatica查询图形筛选器DAC非绑定字段UI实时更新问题
解决Acumatica筛选器字段实时刷新问题
问题原因
在详情数据视图委托中修改筛选器DAC字段后,Acumatica的UI未收到数据变更通知,导致界面无法实时更新,仅在再次执行查询时才会显示上一次的耗时结果。
解决方案
在设置TimeElapsed字段后,手动通知筛选器数据视图触发UI更新,修改后的代码如下:
public virtual IEnumerable details() { Filter filter = this.Filter.Current; Stopwatch stopwatch = Stopwatch.StartNew(); // Retrieve and yield return the results here. . . . stopwatch.Stop(); filter.TimeElapsed = stopwatch.Elapsed.ToString(@"mm\:ss\.ff"); // 标记筛选器记录已更新并通知UI刷新 this.Filter.Update(filter); this.Filter.View.NotifyChanges(); }
代码说明
this.Filter.Update(filter):将修改后的筛选器对象标记为已更新,让数据视图识别到变更。this.Filter.View.NotifyChanges():通知UI层数据已变更,立即刷新对应字段的显示。
如果上述方法未生效,可尝试替换为this.Filter.View.RequestRefresh(),该方法会重新加载筛选器数据,适合需要全量刷新的场景。
内容的提问来源于stack exchange,提问作者kchron
相关产品推荐
相关产品推荐

