What is the best way to transfer table row data from one table to another using buttons?
Once the transfer is complete, how can I capture the key value of the items in the right side table by clicking a submit button?
Check out this link for reference: http://jsfiddle.net/A6bt3/111/
JavaScript:
var app = angular.module('myApp', []);
function checkBoxCtrl($scope){
$scope.tableOne=[
{key: '1', value: 'a'},
{key: '2', value: 'b'},
{key: '3', value: 'c'},
{key: '4', value: 'd'}
];
$scope.btnRight = function () {
}
$scope.btnAllRight = function () {
}
$scope.btnLeft = function () {
}
$scope.btnAllLeft = function () {
}
$scope.submit = function () {
}
};
HTML:
<span>Table One</span>
<div ng-controller="checkBoxCtrl">
<table width="400" border="1">
<tr ng-repeat="data in tableOne" id="item{{data.key}}">
<td width="20px">
<input type="checkbox" ng-model="data.checked">
</td>
<td>{{data.key}}</td>
<td>{{data.value}}</td>
</tr>
</table>
<br>
<div class="">
<input id="btnRight" type="button" value=">" class="listBoxButton" ng-click="btnRight()" />
<br/>
<input id="btnAllRight" type="button" value=">>" class="listBoxButton" ng-click="btnAllRight()" />
<br/>
<input id="btnAllLeft" type="button" value="<<" class="listBoxButton" ng-click="btnAllLeft()" />
<br/>
<input id="btnLeft" type="button" value="<" class="listBoxButton" ng-click="btnLeft()" />
</div>
<span>Table Two</span>
<table width="400" border="1">
<tr ng-repeat="data in tableOne | filter: {checked:true}">
<td> <input type="checkbox" ng-model="data.checked"></td>
<td>{{data.key}}</td>
<td>{{data.value}}</td>
</tr>
</table>
<input id="sbt" type="button" value=">" class="" ng-click="submit()" />