Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity Picker - The backoffice ordering isn't adhered to in code #70

Closed
AndyBoot opened this issue Oct 31, 2023 · 5 comments
Closed

Entity Picker - The backoffice ordering isn't adhered to in code #70

AndyBoot opened this issue Oct 31, 2023 · 5 comments
Labels

Comments

@AndyBoot
Copy link

Describe the bug
When using the entity picker against a doc type property, selecting the entities and pulling through the IEnumerable of entities in code, it isn't giving us a list of entities in the same order as per how they are selected in the content management section of the backoffice. It appears they're just being brought through as per their default order in the custom table.

Looking in the umbracoPropertyData table, it appears the property value is being stored as an integer comma-delimeted array, and in the correct order.

I've managed to work around this for the time being with some dirty code to look up the raw int array in the umbracoPropertyData table and reordering the IEnumerable based on the order of the Id's within the array. Ideally, I shouldn't need to do this.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Ensure there's at least one repository with data
  2. Apply the entity picker against a doc type property
  3. Add items via the content section in a scattered order
  4. Pull in the selected items via code which should give an IEnumerable<entity> object, loop through the selected items to be shown the items in the wrong order from how they were selected

Expected behavior
The IEnumerable<entity> should match the order of the integer comma-delimeted array.

Environment (please complete the following information):

  • Umbraco Version: 12.0.1
  • Product Version: Konstrukt 1.6.5
@AndyBoot AndyBoot added the bug Something isn't working label Oct 31, 2023
@mattbrailsford
Copy link
Contributor

When you say "pull in the selected items via code" are you meaning just accessing the property on the doc type that returns the selected entities?

@AndyBoot
Copy link
Author

AndyBoot commented Nov 1, 2023

Yes correct, i.e.

image

So in this example, Features is the property with the entity picker. So if the custom table had features 1 - 10 in that order, and I only selected features 7, 3, 9, & 1 then what instead gets returned is 1, 3, 7 & 9 when I'd imagine what we should get is the same order in which they were selected.

@mattbrailsford
Copy link
Contributor

Ok, so I've pushed a preview release to https://nuget.outfield.digital/unstable/v3/index.json so if you want to grab the latest 1.6.7 beta I think this should fix it.

@AndyBoot
Copy link
Author

AndyBoot commented Nov 1, 2023

Amazing! Yeah that appears to have done the trick. Thanks Matt!

@mattbrailsford
Copy link
Contributor

Resolved in 10.0.1 and 12.0.1 of UI Builder (also in Konstrukt 1.6.7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants