I have a content type with a field of type "Entity reference" and widget "Inline entity form - Multiple values". I create a node, add multiple entities, drag to rearrange the order of entities, but I can't seem to reflect this order / weightings in my view.
I create a view with relationship "Entity Reference: Referencing entity" and list my entities fields. The only "sort" criteria available that makes any sense is "field_myentities:delta" with the parent node relationship, but using that in sort results in each entity being output twice, and if I use it in fields then each duplicate result has a different delta anyway.
How can I replicate the drag and drop weighting / order of entity references in my view output?
Comments
Comment #1
lucas.constantino CreditAttribution: lucas.constantino commentedSame problem here :(
Comment #2
justaman CreditAttribution: justaman commentedsame here, I tried to remove duplicates http://drupal.stackexchange.com/questions/38450/drupal-7-views-how-to-re... but it does not work for me. If I try the aggregation fix which I consider overwork, all items disappear.
Comment #3
csedax90 CreditAttribution: csedax90 commentedSame problem... nobody says how to solve?
Comment #4
tostinni CreditAttribution: tostinni commentedTo keep the order of those items in views, you need to use the
delta
sort criteria.Comment #5
Joao Sausen CreditAttribution: Joao Sausen commentedUsing the delta criteria in the sort order returns duplications
Comment #6
Drupal8 CreditAttribution: Drupal8 commentedI have the same effect, with the use of the delta sort criteria only to include duplicates. I just remove the sort criteria from the view and this seems to work as expected. The arrange of the Entity Reference been transfer into view results.
Comment #7
calvinjuarez CreditAttribution: calvinjuarez commentedI'm having the same issue. Comment #6 recommends removing the sort criteria, but that doesn't solve OP's question of "How can I replicate the drag and drop weighting / order of entity references in my view output?"
Still no ideas there?
Comment #8
jmuzz CreditAttribution: jmuzz commentedThe answer from @Drupal8 worked for me. Removing all sort criteria has it sorting by its delta in its parent. Tested a few reorderings.
Comment #9
Charles BelovI am getting the same (correct) result as jmuzz in comment #8:
Removing all sort criteria results in the view sorting by the order set in the relationship field.
Comment #10
minorOffense CreditAttribution: minorOffense at Coldfront Labs Inc. commentedI don't see any code to be committed so I'm going to close this. Not sure why it's marked RTBC.