Please retain events when updating table fields

If you have a TDAMemDataTable with events attached to the fields contained within it, then you retrieve the datatable schema again to refresh the fields (because of changes etc), the event handlers are removed.

This is very dangerous as you can easily forget this happens and to re-attach the handler. Can you please make it retain any handlers for fields which persist after the update?

when you retrieve the datatable schema, it calls Fields.Clear and add new fields from scratch.

I’m not sure, that your case should be handled in DAD because you can work with Table1, assign some events in run-time,do something, change LogicalName to Table2 and re-download datatable schema.
in this case Table2 fields will have events from Table1.

I can suggest to handle this case manually in your application.

It’s more of a design-time issue. We hook up some events on fields such as OnGetText but these are then lost if we ever need to repopulate the fields from the schema and it’s easy to forget this.

Thanks, logged as bugs://77075

bugs://77075 got closed with status fixed.

pls update uDADataAdapter.pas as

 THandlerArray = array[0..3] of TMethod;
..
  HandlersToSave : array[0..3] of string = ('OnChange', 'OnValidate', 'OnGetText', 'OnSetText');

and rebuild DA_Core package

Logged as bugs://i64840.

bugs://i64840 was closed as fixed.