[英]Angular table with editable cell
我正在嘗試使用angularJS做一個可編輯的單元格。 我設法做了一個可編輯的程序,但是當我編輯值時,控制器中的值沒有改變。
我正在用這個。
<table md-table>
<thead fix-head md-head md-order="query.order">
<tr md-row>
<th md-column style="box-sizing: content-box"><span>Item</span></th>
<th md-column style="box-sizing: content-box"><span>Coluna do Excel</span></th>
<th md-column style="box-sizing: content-box"><span>Status</span></th>
</tr>
</thead>
<tbody md-body>
<tr md-row ng-repeat="layout in vm.carregarLayoutTeste | filter: filter.search | orderBy: query.order">
<td md-cell>{{layout.Nome}}</td>
<td>
<input type="text" value="{{layout.Coluna}}" ng-readonly='!($index == eEditable)' ng-dblclick="eEditable = $index"/>
</td>
<td md-cell>{{layout.Status ? "OK":"Verifique a Coluna Correta"}}</td>
</tr>
</tbody>
</table>
在js中,我正在使用它。
$scope.eEditable = -1; //-1 by default. It doesn't match any $index from ng-repeat
但是,當我向控制器發送信息時,該單元的信息在乞求中相同。 例:
單元格1具有值TESTE,我進行編輯並更改為NEW,當它到達控制器仍是睾丸時,有人知道我該怎么辦?
謝謝Kaddath,我使用了ng-model這樣的模型,並且運行良好。
<td>
<input type="text" value="{{layout.Coluna}}" ng-readonly='!($index == eEditable)' ng-model="layout.Coluna" ng-dblclick="eEditable = $index"/>
</td>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.