[英]Editable table with AutoForm in Meteor
How can I make a table with input fields in Meteor. 如何在Meteor中创建包含输入字段的表格。 I've used the example from http://autoform.meteor.com/update-each but they only use 1 input field.
我使用了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. 但它在每个
<tr>
周围创建了一个<form>
元素,它搞砸了我的HTML。 What is the correct way to do it? 这样做的正确方法是什么?
Use div
s with CSS: 使用
div
s的CSS:
<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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.