0

我被中继器弄糊涂了!无论我尝试使用列表还是表格,在对 Data("Default") 进行迭代时,我只会得到一个大小为 1 的表格:

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

如果我进入 Content.Toolbar,第二组图标包括一个 + 和 - 这似乎设置了要显示的行数,2 或 3 有时有效,但迟早我会得到一个重复的记录,尽管有只是 Content-Data 表中的数据之一。嗯。

这是我看到的,一个包含重复行的表:(抱歉,我不能发布超过 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>

这是模板配置

这是Content-Data 表(我注意到它没有重复的行!!!)

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

这真的很甜蜜,我会尽力帮助添加到文档中,因为仍然有几个漏洞(;->)

  • j
4

1 回答 1

0

你可能被难住了

  1. 全部!应用程序中的数据(您可以使用 App.Data["typename"]
  2. 只是分配给这个 2sxc 实例的数据 Data["Default"]

使用上述方法创建项目时,您很可能会在应用程序中创建一个新项目,但不会将其分配给实例。它更像是所有项目的数据库,而不仅仅是这个实例的那些。

当您为当前项目创建工具栏时,它可以提供“添加”按钮或“新建”按钮,这是针对当前实例的。但为此它需要打开,Edit.Toolbar(Content, actions: "new")因为它将使用当前实例的内容类型并将其按顺序添加到当前项目之后。

知道了?

于 2016-06-08T16:20:18.720 回答