nuPickers icon indicating copy to clipboard operation
nuPickers copied to clipboard

Different Pickers With Same Relation Type Don't Sync?

Open s6admin opened this issue 11 years ago • 8 comments

We're seeing a major problem with syncing Pickers across Document Types.

We are trying to relate different document types (such as a Product and a Download) using a bidirectional "relation only" data type. We actually have two different pickers, one for each end of the relationship, but have them both mapped to the same Relation Type. The picker for the Product node has a list of Downloads that can be related. The picker for the Download node has a list of Products that can be related. These two lists of Products and Downloads are the same parent/child ids that get saved in the Relation table, but the two pickers do not sync. We can only see the checkboxes from the childId node where the selections were originally made.

If we only use one nuPicker then the values are synced, but that isn't practical because we need a different set of checkboxes depending on which end of the relationship the admin is making the selections (product node or download node).

Has anyone else encountered this? Is this a limitation of nuPickers or are we implementing it wrong? Thank you!

s6admin avatar Nov 20 '14 21:11 s6admin

Removing this line will make it work:

/nuPickers/Shared/RelationMapping/RelationMappingApiController.cs -- line 46.

it checks for the data type definition Id. (in other words, you have to use the same datatypes if you wan't them to sync). I would make this line optional (within the configuration section) If I were the owner of the project.

amainguy avatar Jan 13 '15 20:01 amainguy

Hi, sorry for the late reply. What would you call such a config option, Lock to Data Type ? I image it'd be a check box that appears when "relations only" is selected, and it's probably better to default to not executing that line

Hendy avatar Mar 28 '15 20:03 Hendy

This should also be included in upcoming release =D

enkelmedia avatar Sep 06 '15 12:09 enkelmedia

Agreed!

s6admin avatar Sep 10 '15 19:09 s6admin

+1 I have the same issue - two different doctypes which are related, and I'd like to use synchronized pickers between them, so that an editor can select the relationship from either "side" - whichever is more convenient.

Hmmm... I thought I'd try compiling my own version of nuPickers with that line commented-out... but can't seem to see a "line 46" in the file "/nuPickers/Shared/RelationMapping/RelationMappingApiController.cs"... Have I misunderstood where this is?

I do hope this fix makes it into the next "official" release.

(Ps. Using Umbraco v7.3.4)

hfloyd avatar Jan 20 '16 21:01 hfloyd

Ah, found it. File: \source\nuPickers\Shared\RelationMapping\RelationMapping.cs

Line 37: relations = relations.Where(x => new RelationMappingComment(x.Comment).DataTypeDefinitionId == relationMappingComment.DataTypeDefinitionId);

Commenting that one line and recompiling fixes the issue for me :-)

hfloyd avatar Jan 20 '16 22:01 hfloyd

+1 I'd be happy to do a pull request for this if understood the intention of the comment filtering.

Having dug into this, the fix above results in the inability to remove an item that was added from the other side. I imagine for bidirectional relationship management something more like having a primary side configuration so that the XML in the comments is consistent regardless of the side being set. This should probably just happen instead of the "Lock to Data Type" suggestion above.

Would love some project owner contribution here @Hendy ?

SayTen avatar Apr 05 '16 10:04 SayTen

Yes, each time we begin a new project this issue gets in the way. I'm not sure the value of mapping to a bidirectional relationship if we can't let content editors benefit from it. Asking them to "remember" which node they can make the relationship from is terrible for usability. Anyone able to at least provide some general idea if this item will be addressed?

s6admin avatar Mar 25 '17 19:03 s6admin