0
我想知道是否可以將數組推送到具有特定html特徵的集合observable中。例如,這是我的HTML的外觀爲標準:將數組推入kb.collectionObservable
<thead class = "well">
<th>Date</th>
<th>Reference</th>
<th>Note</th>
<th><button data-bind= "click: add_note" class = "btn btn-mini"><i class="icon-plus"></i></button></th>
</thead>
<tbody data-bind = "foreach: policy_notes">
<td data-bind = "dateTimeString: date_inserted"></td>
<td data-bind = "text: reference"></td>
<td data-bind = "text: note"></td>
<td></td>
</tbody>
但我要推一個新行是一個<input>
元素。我目前正在推新像這樣:
add_note: function(){
page.viewModel.policy_notes.collection().push(
{
date_inserted: (new Date()).toISOString(),
reference: 'HEY!',
note: 'HEY!'
}
);
},
但我想參考和註釋成爲輸入元素。有任何想法嗎?