0

I'm confused by repeaters! Whether I try a list or table, I only get a table size of 1 to begin with when iterating against Data("Default"):

@foreach(var cont in AsDynamic(Data["Default"])){

If I go into the Content.Toolbar, the second set of icons includes a + and - which seems to set the number of rows to display, 2 or 3 sometimes works, but sooner than later I get a one record getting repeated, though there is only 1 of that data in the Content-Data table. Hmmmm.

Here's what I see, a table with duplicate rows: (Sorry I can't post more than 2 pictures as I'm without reputation on Stackflow as of yet.)

Number  Status  Priority  Title  Life  Property  Address  Eye Witness Name  Eye Witness Contact  Time  Assigned To  Description  Entered at  Modified  Outcome  Mapping
Number  Status  Priority  Title  Life  Property  Address  Eye Witness Name  Eye Witness Contact  Time  Assigned To  Description  Entered at  Modified  Outcome  Mapping
1188  0 - New (Unassigned)  0 - New (Unassigned)  Ranting Hippies taking over Island Center Forest  LIFE!  Property!  100 Vashon Way, Vashon, WA 98070  Sally Suzie  567-1000  6/6/2016 10:00:00 PM  Community Operations Section  

Reports are coming in that unruly hippies are taking over the land immediately north of the transfer station.
  6/7/2016 12:01:13 AM   Map it!
1188  0 - New (Unassigned)  0 - New (Unassigned)  Ranting Hippies taking over Island Center Forest  LIFE!  Property!  100 Vashon Way, Vashon, WA 98070  Sally Suzie  567-1000  6/6/2016 10:00:00 PM  Community Operations Section  

Reports are coming in that unruly hippies are taking over the land immediately north of the transfer station.
  6/7/2016 12:01:13 AM   Map it!
1188  0 - New (Unassigned)  0 - New (Unassigned)  Ranting Hippies taking over Island Center Forest  LIFE!  Property!  100 Vashon Way, Vashon, WA 98070  Sally Suzie  567-1000  6/6/2016 10:00:00 PM  Community Operations Section  

Reports are coming in that unruly hippies are taking over the land immediately north of the transfer station.
  6/7/2016 12:01:13 AM   Map it!
1188  0 - New (Unassigned)  0 - New (Unassigned)  Ranting Hippies taking over Island Center Forest  LIFE!  Property!  100 Vashon Way, Vashon, WA 98070  Sally Suzie  567-1000  6/6/2016 10:00:00 PM  Community Operations Section  

Reports are coming in that unruly hippies are taking over the land immediately north of the transfer station.
  6/7/2016 12:01:13 AM   Map it!
1188  0 - New (Unassigned)  0 - New (Unassigned)  Ranting Hippies taking over Island Center Forest  LIFE!  Property!  100 Vashon Way, Vashon, WA 98070  Sally Suzie  567-1000  6/6/2016 10:00:00 PM  Community Operations Section  

Reports are coming in that unruly hippies are taking over the land immediately north of the transfer station.
  6/7/2016 12:01:13 AM   Map it!

Here's the Template

<!-- Table View of Incident Log Entries -->
<div>@Edit.Toolbar(actions: "new", contentType: "Incidents")</div>
<div style="overflow-x:auto;">
<table>
    <thead>
        <tr>
            <td>Number</td>
            <td>Status</td>
            <td>Priority</td>
            <td>Title</td>
            <td>Life</td>
            <td>Property</td>
            <td>Address</td>
            <td>Eye Witness Name</td>
            <td>Eye Witness Contact</td>
            <td>Time</td>
            <td>Assigned To</td>
            <td>Description</td>
            <td>Entered at</td>
            <td>Modified</td>
            <td>Outcome</td>
            <td>Mapping</td>
       </tr>
    </thead>
    <tfoot>
        <tr>
            <td>Number</td>
            <td>Status</td>
            <td>Priority</td>
            <td>Title</td>
            <td>Life</td>
            <td>Property</td>
            <td>Address</td>
            <td>Eye Witness Name</td>
            <td>Eye Witness Contact</td>
            <td>Time</td>
            <td>Assigned To</td>
            <td>Description</td>
            <td>Entered at</td>
            <td>Modified</td>
            <td>Outcome</td>
            <td>Mapping</td>
        </tr>
    </tfoot>
    <tbody>
        @foreach(var cont in AsDynamic(Data["Default"])){
            @:<tr class="sc-element sexy-table-row sexty-table-row-@cont.EntityTitle">
                @:<td>@cont.EntityId</td>
                @:<td>@cont.Status</td>
                @:<td>@cont.Priority</td>
                @:<td>@cont.Title</td>
                @:<td>
                if (cont.Life) { 
                    @:<span style="color:red;"> LIFE! </span>
                }
                @:</td>
                @:<td>
                if (cont.Property) { 
                    @:<span style="color:orange;"> Property! </span>
                }
                @:</td>
                @:<td>@cont.Address</td>
                @:<td>@cont.EyeWitnessName</td>
                @:<td>@cont.EyeWitnessContact</td>
                @:<td>@cont.IncidentTime</td>
                @:<td>@cont.AssignedTo</td>
                @:<td>@Html.Raw(cont.Description)</td>
                @:<td></td>
                @:<td>@cont.Modified</td>
                @:<td>@Html.Raw(cont.Outcome)</td>
                @:<td>@cont.Mapping</td>
            @:</tr>
        }
    </tbody>
</table>
</div>
</br>
@Content.Toolbar
</br>

Here's the Template configuration:

Here's the Content-Data table (which I notice doesn't have duplicated rows!!!)

Also once I get enough rows showing (I have to manually add each row - or list item - that I want?) then I have to figure out paging. The only option I've seen on that is via a paging widget available through the data pipeline, right?! I've not seem any examples with paging yet.

This is really sweet, and I will try to help add to the documentation as there are still a couple holes (;->)

  • j
Vash Juan
  • 37
  • 8

1 Answers1

0

You are probably stumped by

  1. All! data in your app (which you would retrieve using App.Data["typename"]
  2. Just data assigned to this 2sxc instance Data["Default"]

When creating an item using the above method, you will most likely create a new item in the app, but not assign it to the instance. It's more like a DB across all items, not just the ones of this instance.

When you create the toolbar for the current item, then it can provide the "add" button or a "new" button, which is for the current instance. But for that it needs to be on the Edit.Toolbar(Content, actions: "new") because it will then use the content type of the current instance and will add it in sequence after the current item.

got it?

iJungleBoy
  • 5,325
  • 1
  • 9
  • 21