Hi,
after clicking of edit button it was dispalying relevant records on gridview
currently issue is that at 2nd page (11th record)
if i have changed customer value it was not changing Product value
@{
Layout = null;
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Index</title>
<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/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/angular-utils-pagination@0.11.1/dirPagination.js"></script>
<script type="text/javascript">
var app = angular.module('MyApp', ['angularUtils.directives.dirPagination'])
app.controller('MyController', function ($scope, $http, $window) {
$scope.Details = [{ CName: "Item1" }, { CName: "Item2"}];
GetCategory();
function GetCategory() {
$scope.categories = [];
$http({
method: 'Get',
url: '/home/GetCategories/'
}).success(function (data, status, headers, config) {
$scope.categories = data;
}).error(function (data, status, headers, config) {
$scope.message = 'Unexpected Error';
});
}
$scope.GetProducts = function (Category, index) {
if (Category != null) {
$http({
method: 'Post',
url: '/home/GetProducts/',
params: { CategoryID: Category }
}).success(function (data, status, headers, config) {
if (data.length > 0) {
$scope.Details[index].products = data;
} else {
$scope.Details[index].products = '';
}
}).error(function (data, status, headers, config) {
$scope.message = 'Unexpected Error';
});
} else {
$scope.Details[index].products = '';
}
}
$scope.Addrow = function (detail) {
debugger;
$scope.Details.push({ CName: '' });
};
});
</script>
</head>
<body ng-app="MyApp" ng-controller="MyController">
<table id="tblOrders" class="table table-responsive">
<tr>
<th>Name</th>
<th>Category</th>
<th>Product</th>
</tr>
<tbody dir-paginate="detail in Details|orderBy:sortKey:reverse|filter:search|itemsPerPage:1">
<tr>
<td>{{detail.CName}}</td>
<td>
<select class="input-sm form-control" select2="" name="CategortName" ng-model="detail.Category"
containercssclass="all" ng-change="GetProducts(detail.Category,$index)" ng-options="c.CategoryID as c.CategortName for c in categories">
<option value="">Select Category</option>
</select>
</td>
<td>
<select select2="" ng-model="detail.Product" ng-disabled="!detail.products" class="input-sm form-control"
ng-options="s.ProductID as s.ProductName for s in detail.products">
<option value="">-- Select Product --</option>
</select>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>
<button type="button" class="btn btn-primary " ng-click="Addrow()">Add</button>
</td>
</tr>
</tfoot>
</table>
<dir-pagination-controls direction-links="true" boundary-links="true">
</dir-pagination-controls>
</body>
</html>