How can I make a table with input fields in Meteor. I've used the example from http://autoform.meteor.com/update-each but they only use 1 input field.
如何在Meteor中创建包含输入字段的表格。我使用了http://autoform.meteor.com/update-each中的示例,但它们只使用了1个输入字段。
The functionality works with this code:
该功能适用于此代码:
<tbody>
{{#each persons}}
{{#autoForm id=makeUniqueID type="update" collection=Collections.Persons doc=this autosave=true}}
<tr>
<td>{{> afFieldInput name="fullName" label=false}}</td>
<td>{{> afFieldInput name="email" label=false}}</td>
<td>{{> afFieldInput name="address" label=false}}</td>
<td><button type="submit" class="btn btn-xs btn-danger">Delete</button></td>
</tr>
{{/autoForm}}
{{/each}}
</tbody>
but it created a <form>
element around each <tr>
and it screws up my html. What is the correct way to do it?
但它在每个周围创建了一个
1 个解决方案
#1
1
Use div
s with CSS:
使用CSS与div:
<div class="table">
{{#each persons}}
{{autoform class="tr"}}
<div class="td">{{> afQuickField}}</div>
<div class="td">{{> afQuickField}}</div>
<div class="td">{{> afQuickField}}</div>
{{/autoform}}
{{/each}}
</div>
And style it as such:
并将其样式设置为:
.table {
display: table;
}
.tr {
display: table-row;
}
.td {
display: table-cell
}
#1
1
Use div
s with CSS:
使用CSS与div:
<div class="table">
{{#each persons}}
{{autoform class="tr"}}
<div class="td">{{> afQuickField}}</div>
<div class="td">{{> afQuickField}}</div>
<div class="td">{{> afQuickField}}</div>
{{/autoform}}
{{/each}}
</div>
And style it as such:
并将其样式设置为:
.table {
display: table;
}
.tr {
display: table-row;
}
.td {
display: table-cell
}