1

I like to use 2 dot:repeater(s) nested in one dothtml example :

<dot:Repeater DataSource="{value: Projects}">
    <div class="project">
        <dot:LinkButton Click="{command: _root.RedirectToTasks(Id)}">{{value: Title}}</dot:LinkButton>
        <dot:Repeater DataSource="{value: _parent.Tasks}" WrapperTagName="table">
            <ItemTemplate>
                <tr>
                    <td>{{value: Title}}</td>
                    <td>{{value: Completed ? ("Finished: " + CompletionDate) : "Not yet"}}</td>
                    <td>
                        <dot:LinkButton Text="Done"
                                        Click="{command: CompleteTask()}"
                                        Visible="{value: !Completed}" />
                    </td>
                </tr>
            </ItemTemplate>
        </dot:Repeater>
    </div>
</dot:Repeater>

i try different options for the _parent. in the task part, but i don't get it working. in other frameworks it is possible to alias the main repeater example: 'DataSource="{value: Projects}" as project' and then its possible in the nested repeater to use 'DataSource="{value: project.Tasks}"' does someone know how to get this working ?

basdroid
  • 43
  • 3

1 Answers1

1

In the inner Repeater, you can use just {value: Tasks}, or alternatively {value: _this.Tasks}.

There is also a second caveat in the code: the RenderWrapperTag="table" is not a good idea if you don't have the tbody element. Some browsers will try to add the missing tbody and can break the DOM structure and cause the Repeater to stop working.

In general, you want to place the Repeater inside the <table> element and use RenderWrapperTag="tbody":

<table>
    <dot:Repeater DataSource="{value: Tasks}" WrapperTagName="tbody">
        <ItemTemplate>
            <tr>
                <td>{{value: Title}}</td>
                <td>{{value: Completed ? ("Finished: " + CompletionDate) : "Not yet"}}</td>
                <td>
                    <dot:LinkButton Text="Done"
                                    Click="{command: CompleteTask()}"
                                    Visible="{value: !Completed}" />
                </td>
            </tr>
        </ItemTemplate>
    </dot:Repeater> 
</table>
Tomáš Herceg
  • 1,595
  • 1
  • 13
  • 18
  • Thanks this will work, i think WrapperTagName="tbody" do the trick, in my orginal code i use the tags.(i changed the code for the question to the objects which are used in the sample projects) – basdroid Jul 18 '17 at 08:23