Hi,
I have one add button on each row
after clicking of add button based upon that particular Id(ex:Id-1) i need to create one new row with same Id , same Name and Country should be blank
Could you please help me
@{
Layout = null;
}
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
<script src="~/masters/dirpagination.js"></script>
<script type="text/javascript">
var app = angular.module('MyApp', ['angularUtils.directives.dirPagination'])
app.controller('MyController', function ($scope, $window) {
$scope.Customers = [{
Id:1, Name: "John Hammond", Country: "United States",
}, {
Id:2,Name: "John Hammond1", Country: "United States",
}, {
Id:3, Name: "John Hammond2", Country: "United States",
}];
$scope.Add = function () {
var newrowNo = $scope.Customers.length + 1;
$scope.Customers.push({ Name: '', lad: "" + newrowNo });
};
});
</script>
</head>
<body>
<div ng-app="MyApp" ng-controller="MyController">
<table cellpadding="0" cellspacing="0">
<tr>
<th>Id</th>
<th>Name</th>
<th>Country</th>
<th> </th>
</tr>
<tbody dir-paginate="m in Customers|orderBy:sortKey:reverse|filter:search|itemsPerPage:10">
<tr>
<th>Id</th>
<td>
<input type="text" value="{{m.Name}}" />
</td>
<td>
<input type="text" value="{{m.Country}}" />
</td>
<td>
<button type="button" class="btn btn-success btn-sm" ng-click="Add()" @*ng-click="add1($index)"*@><span class="glyphicon glyphicon-plus"></span></button>
</td>
</tr>
</tbody>
<dir-pagination-controls max-size="10"
direction-links="true"
boundary-links="true">
</dir-pagination-controls>
</table>
</div>
</body>
</html>