【发布时间】:2019-02-28 18:01:37
【问题描述】:
HTML代码
<label class="control-label">Contact Person</label>
<input class="form-control" type="text" placeholder="Enter Contact name" data-bind="value: ContactPerson" data-validate='{"required":"true"}'><br />
<label class="control-label">ContactNo</label>
<input class="form-control" type="tel" data-bind="value: ContactNo" placeholder="ContactNo" data-validate='{"required":"true"}'><br />
<label class="control-label">E-Mail</label>
<input class="form-control" type="email" data-bind="value: Email" placeholder="Email" data-validate='{"required":"true","email":"true"}'><br />
<table class="table table-hover table-bordered" id="listTable">
<thead>
<tr>
<th>ContactPerson</th>
<th>ContactNo</th>
<th>Email</th>
<th></th>
</tr>
</thead>
<tbody data-bind="template:{name: 'Process-list',
foreach: rootViewModel.BodyContent.ProcessList }">
</tbody>
</table>
当我点击添加按钮时,三个文本框中的数据应该绑定到网格, 当我单击网格中行的删除按钮时,它应该会消失,因为我需要视图模型。
谢谢
【问题讨论】:
-
你已经有一些视图模型代码了吗?您也可以将其添加到问题中,如果我们对其进行修改,可能会让您更容易理解,而不是我们为您提供从头开始编写的视图模型。