Design Question - DropDown Objects #1769
Replies: 4 comments 3 replies
-
There's not one right answer. If I understand you correctly, the What I normally do in cases like this is:
|
Beta Was this translation helpful? Give feedback.
-
Yeah, I basically have a JobTypeEdit and a corresponding DynamicList which is used on a Blazor grid which allows the admin to add new job types if that is needed (rarely will be). Then I have a UserEdit which is used on the User admin screen to manage the all the users which includes a column that somehow needs to let the user pick one or more JobTypes which would be bound to UserEdit.JobTypes. I started with a ReadOnlyListBase of job type objects (ReadOnlyJobType) but that didn't quite work. so UserEdit.JobTypes was a ReadOnlyListBase. For some reason when I turned off the readonly flag and modified the list the object was not marked as dirty. So even though I was able to achieve most of what I was wanting, binding didn't work correctly. When a user edited user row and added a new job type, IsDirty was still false. So that is why I thought I would ask what others were doing. I assumed it was something to do with the ReadOnlyListBase that I had chosen. |
Beta Was this translation helpful? Give feedback.
-
I don't think I can add a
|
Beta Was this translation helpful? Give feedback.
-
Yes, one user may be assigned 1 job type and another may have 3. Those will be different based on the user (UserEdit). The control I'm using is a third-party Blazor control that allows you to select one or more items in the dropdown. So for example, I select my user on the grid and get the EditForm screen displays and the dropdown shows I currently have two job types assigned to me (ex: Teacher and Janitor), the dropdown shows that I can select all the other job types available at which point I can select more to add. This third party Blazor control expects both data sources (the dropdown and the items selected) to support the |
Beta Was this translation helpful? Give feedback.
-
I'm doing a Blazor app and have what surely is a simple CSLA design question. Basically I have a User class that can be assigned one or more JobTypes (which has a name and a couple of other properties I need). I initially thought I would add a property for JobTypes as a ReadOnlyBindingListBase collection but that doesn't really work as the list changes based on what is assigned by the admin. I didn't think it was appropriate to do a BusinessBase object that could be modified because there is another screen that a handles crud operations on Job Types (this via a DynamicList collection bound a to grid).
So my question is how should a scenario such as this be handled in CSLA where you have a list of items like JobTypes that won't change often but that will be assigned to a BusinessBase object like User object?
From a UI perspective it is just a grid with a UserName column and a Job Types column that contains a muti-select dropdown so the admin can pick one or more JobType objects. All possible JobTypes need to be bound to the dropdown so the user can select one and then whatever is selected must be bound to the User.JobTypes property. How are others designing CSLA objects with such a requirement?
Beta Was this translation helpful? Give feedback.
All reactions