如何让转发器在2sxc中工作?

时间:2016-06-07 13:32:24

标签: 2sxc

我对中继器感到困惑!无论我是尝试列表还是表,在迭代数据(“默认”)时,我只会得到一个1的表大小:

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

如果我进入Content.Toolbar,第二组图标包含一个+和 - 这似乎设置要显示的行数,2或3有时可以工作,但不久之后我得到一个记录重复,尽管Content-Data表中只有1个数据。 Hmmmm。

这是我看到的,一个包含重复行的表:(抱歉,我不能发布超过2张图片,因为我在Stackflow上没有声望。)

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!

这是模板

<!-- 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>

这是Template configuration

这是Content-Data table (which I notice doesn't have duplicated rows!!!)

此外,一旦我获得足够的行显示(我必须手动添加每行 - 或列表项 - 我想要?)然后我必须弄清楚分页。我见过的唯一选择是通过数据管道提供的分页小部件,对吧?!我似乎还没有任何分页的例子。

这真的很好,我会尝试帮助添加文档,因为还有一些漏洞(; - &gt;)

  • Ĵ

1 个答案:

答案 0 :(得分:0)

你可能被

难住了
  1. 所有!您应用中的数据(您可以使用App.Data [&#34; typename&#34;]
  2. 检索这些数据
  3. 仅分配给此2sxc实例的数据数据[&#34;默认&#34;]
  4. 使用上述方法创建项目时,您很可能会在应用程序中创建一个新项目,但不会将其分配给实例。它更像是跨所有项目的数据库,而不仅仅是这个实例的数据库。

    当您为当前项目创建工具栏时,它可以提供&#34;添加&#34;按钮或&#34; new&#34;按钮,用于当前实例。但是为此它需要在Edit.Toolbar(Content, actions: "new")上,因为它将使用当前实例的内容类型,并将在当前项之后按顺序添加它。

    得到了吗?