Hi Support Team,
I have an API that retrieves a user list to display in the dropdown. The user object includes a flag (isDefault) to indicate the default user, which is automatically set for the dropdown when creating an employee within the application.
However, I am stuck trying to set the defaultValue to the user marked as the default. How can I address this issue?
For more details, please see my screenshot.
Hope to hearing from you guys soon. Thanks
- ABP Framework version: v8.0.4
- UI Type: Angular
- Database System: EF Core
- Tiered (for MVC) or Auth Server Separated (for Angular): yes
- Exception message and full stack trace:
- Steps to reproduce the issue:
5 Answer(s)
-
0
Hello
Can you once try to this code If it is helpful for you.
options: data => { const service = data.getInjected(UserService); return service .getList({ filterText: '', roleName: UserRole.Admin + ',' + UserRole.CountryManager + ',' + UserRole.LineManager, isFromEditUser: true }) .pipe( map((data: UserDto[]) => { const items = data.filter(x => !x.isLockedOut); // Find the user marked as default const index = items.findIndex(x => x.isDefault); const userDefault = index !== -1 ? `${items[index].id}` : null; // Handle case where no default user exists // Return both the options and the default value return { items: items.map(item => ({ key: item.fullName, value: item.id })), defaultValue: userDefault }; }) ); }, defaultValue: data => data.defaultValue, // Bind the default value here isExtra: prop.isExtra, // Your validation logic }); }
Thank you
-
0
-
0
Can you share your sample code and steps to reproduce this issue.
-
0
-
0
Hello
Please chek this link https://abp.io/support/questions/7298/Angular-Identity-and-Account-form-extensions-set-default-value-using-extra-properties#answer-3a1303f3-aadd-04de-88e5-250c8dbb773f
Thank you