0

I am building a content type which has a field that reference to the same entity with allow multiple value, and enable add new and enable add existing in the Reference to Entity field. basically the concept is creating a self reference table, where Person (Entity) is a friend to multiple Persons. while I am adding the data, the interface allow me to add new Entity in the reference field perfectly but the new Person (Entity) that is added during adding the parent item, doesn't show in the main list. enter image description here like above, the Person George has (Bassel and Manoael) as friends, where i did assign Bassel as a friend to George while i am filling it's data and did add Manoael as new item during that process, but Manoael is not listed in the main loop.

the Razor view that i used is

@foreach(var lead in AsDynamic(Data["Default"])){
<div class="sc-element">@Edit.Toolbar(lead)
    <strong>First Name: @lead.FirstName</strong>
    <br/>
    @Html.Raw(lead.Bio)
    <hr>
    <strong>Friend of:</strong>
    <ul>
    @foreach(var item in AsDynamic(lead.ReleatedTo)){
        <li>@item.FirstName</li>
    }
    </ul>
    <hr>
</div>
<br /><br />

}

1 Answers1

0

Your main list is showing all "Person" objects which are assigned to this module instance. I believe what you're looking for is a list of all "Person" objects in the app, which can be accessed using AsDynamic(App.Data["Person"]) instead of just Data["..."].

see also http://2sxc.org/en/blog/post/12-differences-when-templating-data-instead-of-content

iJungleBoy
  • 5,325
  • 1
  • 9
  • 21