Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mark 122 posts 255 karma points
    Jun 26, 2014 @ 13:11
    Mark
    0

    Custom datatype dependant on another property in 6.1.6

    Hey Guys, a little help/advice if possible :-)

    In my project, I have a couple of types of members, Companis and Contacts. Contacts are linked to Companies via a property at time of creation/approval.

    What I'm after is the best way of creating a custom data type to show Contacts that can take the value from a Company data type if it exists already.

    What I have is a media item that is linked to a specific Contact at a Company. I currently have 2 custom data types, one that lists out all Company members, and another that lists out all Contact members. The Contact data type looks for a property on the current node that contains the Company member, and if it exists, filters the Contact list for that Company (this works fine, but if I change the company, the Contacts are not refreshed unless I reload the current node manually).

    I have also created a Web API controller that can return a list of Contact members based on a Company member Id and I am using this to update the Contact data type (it's a dropdown list) with the relevant Contacts when the Company dropdown is changed (I do this by saving the Company Id to a hidden input and triggerring a changed even on that input. The Contact data type has some javascript that watches for the change event, fetches the new Company member id and uses it to get via ajax the list of filtered Contact members into the Contact dropdown). This works so much as I am getting the new list of Contacts, but saving the media item ignores my newly selected Contact member data type.

    Have I gone about this the wrong way, or, what am I missing/doing wrong to make it work?

    I can provide code if needed, nt sure if it'll add anything at this stage though..

    Any help would be appreciated.

    Mark

Please Sign in or register to post replies

Write your reply to:

Draft