You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, our RecordValidators only run on uncommitted records; however, we have come across a few client-apps that expect validation to run on records created via calls to loadData and updateData as well (mainly for filtering - see #2916). A couple ideas that have been raised:
Add Store.validateCommittedRecords flag to enable validation on all records
Add Record.requiresValidation flag for more granular control per Record - could be set by app-developers by passing a flag to Store.loadData and Store.updateData. This is of course more complicated and may not be necessary for the current use cases.
An alternative approach for achieving more granular control per Record would be for Store.validateCommittedRecords to accept a boolean OR callback in the form of ((record: StoreRecord) => boolean). This might be more elegant, more flexible and less complicated than the approach mentioned above.
For context, a couple reasons apps may wish to validate programmatically added records:
When validation rules are configured to reflect certain business conditions users need to look out for. I.e. data is loaded from some external source, and validators flag potential problems for the user to resolve.
When Grids are being used as Forms, and the initial state is expected to be incomplete (similar to the initial state passed to FormModel.init)
The text was updated successfully, but these errors were encountered:
Bumping this since it just came up again with another project. In this case, the initial data should be considered "invalid" until the user corrects it. It is also important to keep track of the dirty state (records the user hasn't yet corrected), ability to revert records, add records, etc.
Easiest workaround at the moment is this, but obviously not a long-term solution / prone to breaking changes / etc.
Currently, our
RecordValidators
only run on uncommitted records; however, we have come across a few client-apps that expect validation to run on records created via calls toloadData
andupdateData
as well (mainly for filtering - see #2916). A couple ideas that have been raised:Store.validateCommittedRecords
flag to enable validation on all recordsRecord.requiresValidation
flag for more granular control perRecord
- could be set by app-developers by passing a flag toStore.loadData
andStore.updateData
. This is of course more complicated and may not be necessary for the current use cases.Record
would be forStore.validateCommittedRecords
to accept aboolean
OR callback in the form of ((record: StoreRecord) => boolean
). This might be more elegant, more flexible and less complicated than the approach mentioned above.For context, a couple reasons apps may wish to validate programmatically added records:
Grids
are being used asForms
, and the initial state is expected to be incomplete (similar to the initial state passed toFormModel.init
)The text was updated successfully, but these errors were encountered: