Replies: 1 comment
-
HI @curt-w, this is pretty interesting approach and we are thinking of including something similar as well. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've devised a proof of concept that I'm using that builds upon the existing Datalist. Please keep in mind its a rough cut and not all features / functionality are implemented; meant to communicate the concept.
Current Datalist control supports binding an IEnumerable of basic types (i.e., number, string, enum); this works well when binding to model fields of basic types. However, the existing Datalist control cannot be used for binding against complex types - i.e. other domain models.
Given the concept of a "sales order" which has a "customer" field, we'd need to leverage DTOs and simplify our domain model's definition to a string, int, etc. - perhaps a property CustomerId. Upon save, we'd have to update the actual domain model's customer field with the Customer object, etc.
This control allows the binding of complex objects and leverages an expression parameter for determining the display string. The list of TItem's passed in get stored in a Dictionary<string, TItem>, where the dictionary key is the item's display string - this is crucial for mapping the selected control value back to the complex type.
Here is an example of the implementation
And here is the DatalistV2 control
Beta Was this translation helpful? Give feedback.
All reactions