我已經爲可擴展/可摺疊表格添加了一些html代碼,我試圖將它們放入流星應用程序中。 code here使用集合中的項目填充流星中的表格
我的主要問題是當我在流星應用程序中填充表格時,它不會爲我的集合中的每個新項目(如上面的示例)創建一個新的可展開行。目前它僅填充集合中的所有數據的一行。 (如以下的圖片)
這是我的流星代碼:
<template name="adminPage">
<div class="container">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">Students Waiting</div>
<div class="panel-body">
<table class="table table-condensed table-striped" id="outer-table">
<thead id="top-heading">
<tr>
<th></th>
<th >Name</th>
<th >Phone Number</th>
<th >VIP ID/USC ID</th>
<th >Current Status</th>
</tr>
</thead>
<tbody>
<tr data-toggle="collapse" data-target="#demo1" class="accordion-toggle">
<td>
{{> expandButton}}
</td>
<td>
{{> listName}}
</td>
<td>
{{> listNumber}}
</td>
<td>
{{> listVIP}}
</td>
<td> waiting</td>
</tr>
<tr>
<td colspan="12" class="hiddenRow">
<div class="accordian-body collapse" id="demo1">
<table class="table table-striped">
<thead id="innter-table">
<tr class="info">
<th id="inner-heading">Reason for Visit</th>
<th id="inner-heading">Current Major</th>
<th id="inner-heading">Intended Major</th>
<th id="inner-heading">Comments</th>
<th id="inner-heading"></th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{> listReason}}
</td>
<td>
{{> listCurrent}}
</td>
<td>
{{> listIntended}}
</td>
<td>
{{> listComments}}
</td>
<td>
{{> listDisclaimer}}
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<template name="expandButton">
<button class="btn btn-default btn-xs btn-circle">
<span id="plus" class="glyphicon glyphicon-plus"></span>
</button>
<template name="listName">
{{#each student_name}}
{{Name}}
<br>
{{/each}}
<template name="listNumber">
{{#each student_number}}
{{PhoneNumber}}
<br>
{{/each}}
<template name="listVIP">
{{#each student_ID}}
{{VipID}}
<br>
{{/each}}
<template name="listReason">
{{#each student_Reason}}
{{ReasonForVisit}}
<br>
{{/each}}
<template name="listCurrent">
{{#each student_Current}}
{{CurrentMajor}}
<br>
{{/each}}
<template name="listIntended">
{{#each student_Intended}}
{{IntendedMajor}}
<br>
{{/each}}
<template name="listComments">
{{#each student_Comments}}
{{Comments}}
<br>
{{/each}}
<template name="listDisclaimer">
{{#each student_Disclaimer}}
<button class="btn btn-default btn-sm" data-toggle="modal" data-target="#myModal" contenteditable="false">
<span class="glyphicon glyphicon-edit"></span>
</button>
<button class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-trash"></span>
</button>
<br>
{{/each}}
所以我的主要問題是如何去有關從每個項目獲得的集合中的數據在一個新行來填充,使每行是隻有來自該項目的信息可擴展?
另外我該如何去設置數據目標和id爲集合中的每個項目的唯一值,以便該行只擴展它的相應數據?
例如:
<tr data-toggle="collapse" data-target="#demo1" class="accordian toggle">
and
<div class="accordian-body collapse" id="demo1">
using something like
<tr data-toggle="collapse" data-target="#(persons id number)" class="accordian toggle">
and
<div class="accordian-body collapse" id="(persons id number)">
謝謝!