当我更改&#34中的值时,选择框" (例如10 20 30等)它调用Api并给出20(选择框值)记录。我获得了20条记录,但是在UI中它显示前10条记录,但它没有显示20条记录,因为该表具有ng-if条件。在ng之外 - 如果它显示20条记录,但我需要ng-if条件。我该如何解决这个问题
$scope.countperpage = [10, 20, 30, 40, 50, 60];
var range = [];
$scope.numOfPage = 0;
$scope.Detailchangevalue = function(Detailspage) {
$scope.currentPage = 1;
$scope.entriespage = Detailspage;
$scope.filterObj = {
boxlevelind: $rootScope.DetailsboxFilter,
pagecountrequired: 'y',
currentpagenumber: $scope.currentPage,
pagesize: $scope.entriespage
};
e2eservice.getDetailrecords($scope.filterObj, $rootScope.DetailsnameFilter, $rootScope.DetailsboxFilter, $scope.type1).then(function(result) {
if (result.errors) {
console.log('Error');
$scope.errorDetailMsg = true;
} else {
$scope.errorDetailMsg = false;
$scope.DetailDetails = result;
var totalPage = result.PAGE_COUNT;
$scope.totalPage = totalPage;
var startPage = 1;
if (totalPage > 10) {
totalPage = 10;
}
range = [];
for (var i = startPage; i <= totalPage; i++) {
range.push(i);
}
$scope.numOfPage = range;
}
});
};
$scope.getDetailrecords = function() {
$scope.Detailloader = true; // Detail Loader
$scope.filterObj = {
boxlevelind: $rootScope.DetailsboxFilter,
pagecountrequired: 'y',
currentpagenumber: $scope.currentPage,
pagesize: $scope.entriespage
};
e2eservice.getDetailrecords($scope.filterObj, $rootScope.DetailsnameFilter, $rootScope.DetailsboxFilter, $scope.type1).then(function(result) {
if (result.errors) {
var translateObj = $filter('translate');
var translateCaption = translateObj(result.errors.status);
alertpopupservice.setErrorMessage(translateCaption);
$scope.errorDetailMsg = true;
} else {
$scope.errorDetailMsg = false;
$scope.DetailDetails = result;
$scope.Detailloader = false;
var totalPage = result.PAGE_COUNT;
var totalPageTemp = result.PAGE_COUNT;
$scope.totalPage = totalPage;
var currentPage = $scope.currentPage;
var startPage = 1;
if (totalPage > 10) {
totalPage = 10;
if (currentPage > 6) {
totalPage = totalPage + (currentPage - 6);
startPage = 1 + (currentPage - 6);
if (totalPageTemp > totalPage) {
startPage = 1 + (currentPage - 6);
} else {
totalPage = totalPageTemp;
startPage = totalPageTemp - 10;
//startPage=1+(currentPage-6);
}
}
}
range = [];
for (var i = startPage; i <= totalPage; i++) {
range.push(i);
}
$scope.numOfPage = range;
}
});
};
$scope.getDetailrecords();
$scope.getDetailrecordsByPagination = function(currentPage) {
//alert($scope.currentPage);
$scope.Detailloader = true;
if (currentPage !== '') {
var tol = parseInt($scope.totalPage);
if (parseInt(currentPage) > tol) {
alertpopupservice.setErrorMessage('Invalid page number');
// alert('Invalid page number');
//$scope.currentPage=$scope.totalPage;
$scope.currentPage = '';
} else {
$scope.currentPage = currentPage;
$scope.filterObj = {
boxlevelind: $rootScope.DetailsboxFilter,
pagecountrequired: 'y',
currentpagenumber: $scope.currentPage,
pagesize: $scope.entriespage
};
e2eservice.getDetailrecords($scope.filterObj, $rootScope.DetailsnameFilter, $rootScope.DetailsboxFilter, $scope.type1).then(function(result) {
if (result.errors) {
var translateObj = $filter('translate');
var translateCaption = translateObj(result.errors.status);
alertpopupservice.setErrorMessage(translateCaption);
$scope.errorDetailMsg = true;
$scope.Detailloader = false;
} else {
$scope.errorDetailMsg = false;
$scope.Detailloader = false;
$scope.DetailDetails = result;
var totalPage = result.PAGE_COUNT;
var totalPageTemp = result.PAGE_COUNT;
$scope.totalPage = totalPage;
var startPage = 1;
if (totalPage > 10) {
totalPage = 10;
if (currentPage > 6) {
totalPage = totalPage + (currentPage - 6);
startPage = 1 + (currentPage - 6);
if (totalPageTemp > totalPage) {
startPage = 1 + (currentPage - 6);
//console.log('ok '+startPage);
} else {
totalPage = totalPageTemp;
startPage = totalPageTemp - 10;
//startPage=1+(currentPage-6);
}
}
}
range = [];
for (var i = startPage; i <= totalPage; i++) {
range.push(i);
}
$scope.numOfPage = range;
}
});
}
}
};
&#13;
<div class="row e2e-details-scroll" ng-class="{'e2e-norecord-space': errorDetailMsg == true}">
<div class="col-md-12">
<table ng-if="!!DetailDetails" class="table table-bordered" id="e2e-detailsTable" datatable="ng" dt-options="configOption">
<thead class="thead-inverse">
<tr class="tableHeading" ng-repeat="data in DetailDetails.DATA | limitTo: 1">
<th class="detaildetalis-heading" table-filter tablename="e2e-detailsTable" ng-repeat="(key,value) in data "> {{"MESSAGE."+ key | translate}} </th>
</tr>
</thead>
<tbody>
<tr ng-repeat="data in DetailDetails.DATA">
<td class="detaildetalis-records" ng-repeat="(key,value) in data"> {{ value }} </td>
</tr>
</tbody>
</table>
<!-- .Table End -->
</div>
<!-- .col-md-12 End -->
</div>
<!-- 2.row End -->
<div class="row e2e-j-pagination" ng-class="{'e2e-norecord-space': errorDetailMsg == true}">
<div ng-show="!errorDetailMsg">
<div class="col-md-8">
<div class="row">
<div class="import-table-pagination">
<div class="pagination float-left"> <a ng-class="{active: i == currentPage}" href="#" ng-repeat="i in numOfPage" ng-click="getDetailrecordsByPagination(i)">{{i}}</a> </div>
<div class="goto-page">
<lable> Go to page </lable>
<input type="text" ng-model="currentPage" aria-invalid="false" ng-change="getDetailrecordsByPagination(currentPage)" /> </div>
<div class="pagination-per-page">
<lable>Entries per page </lable>
<div class="selectParent-e2e-shipment pagination-select-container">
<select ng-options="a for a in countperpage" ng-model="entriespage" ng-change="Detailchangevalue(entriespage)"> </select>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 3.row End -->
</div>
&#13;
$scope.countperpage = [10, 20, 30, 40, 50, 60];
var range = [];
$scope.numOfPage = 0;
$scope.Detailchangevalue = function(Detailspage) {
$scope.currentPage = 1;
$scope.entriespage = Detailspage;
$scope.filterObj = {
boxlevelind: $rootScope.DetailsboxFilter,
pagecountrequired: 'y',
currentpagenumber: $scope.currentPage,
pagesize: $scope.entriespage
};
e2eservice.getDetailrecords($scope.filterObj, $rootScope.DetailsnameFilter, $rootScope.DetailsboxFilter, $scope.type1).then(function(result) {
if (result.errors) {
console.log('Error');
$scope.errorDetailMsg = true;
} else {
$scope.errorDetailMsg = false;
$scope.DetailDetails = result;
var totalPage = result.PAGE_COUNT;
$scope.totalPage = totalPage;
var startPage = 1;
if (totalPage > 10) {
totalPage = 10;
}
range = [];
for (var i = startPage; i <= totalPage; i++) {
range.push(i);
}
$scope.numOfPage = range;
}
});
};
$scope.getDetailrecords = function() {
$scope.Detailloader = true; // Detail Loader
$scope.filterObj = {
boxlevelind: $rootScope.DetailsboxFilter,
pagecountrequired: 'y',
currentpagenumber: $scope.currentPage,
pagesize: $scope.entriespage
};
e2eservice.getDetailrecords($scope.filterObj, $rootScope.DetailsnameFilter, $rootScope.DetailsboxFilter, $scope.type1).then(function(result) {
if (result.errors) {
var translateObj = $filter('translate');
var translateCaption = translateObj(result.errors.status);
alertpopupservice.setErrorMessage(translateCaption);
$scope.errorDetailMsg = true;
} else {
$scope.errorDetailMsg = false;
$scope.DetailDetails = result;
$scope.Detailloader = false;
var totalPage = result.PAGE_COUNT;
var totalPageTemp = result.PAGE_COUNT;
$scope.totalPage = totalPage;
var currentPage = $scope.currentPage;
var startPage = 1;
if (totalPage > 10) {
totalPage = 10;
if (currentPage > 6) {
totalPage = totalPage + (currentPage - 6);
startPage = 1 + (currentPage - 6);
if (totalPageTemp > totalPage) {
startPage = 1 + (currentPage - 6);
} else {
totalPage = totalPageTemp;
startPage = totalPageTemp - 10;
//startPage=1+(currentPage-6);
}
}
}
range = [];
for (var i = startPage; i <= totalPage; i++) {
range.push(i);
}
$scope.numOfPage = range;
}
});
};
$scope.getDetailrecords();
$scope.getDetailrecordsByPagination = function(currentPage) {
//alert($scope.currentPage);
$scope.Detailloader = true;
if (currentPage !== '') {
var tol = parseInt($scope.totalPage);
if (parseInt(currentPage) > tol) {
alertpopupservice.setErrorMessage('Invalid page number');
// alert('Invalid page number');
//$scope.currentPage=$scope.totalPage;
$scope.currentPage = '';
} else {
$scope.currentPage = currentPage;
$scope.filterObj = {
boxlevelind: $rootScope.DetailsboxFilter,
pagecountrequired: 'y',
currentpagenumber: $scope.currentPage,
pagesize: $scope.entriespage
};
e2eservice.getDetailrecords($scope.filterObj, $rootScope.DetailsnameFilter, $rootScope.DetailsboxFilter, $scope.type1).then(function(result) {
if (result.errors) {
var translateObj = $filter('translate');
var translateCaption = translateObj(result.errors.status);
alertpopupservice.setErrorMessage(translateCaption);
$scope.errorDetailMsg = true;
$scope.Detailloader = false;
} else {
$scope.errorDetailMsg = false;
$scope.Detailloader = false;
$scope.DetailDetails = result;
var totalPage = result.PAGE_COUNT;
var totalPageTemp = result.PAGE_COUNT;
$scope.totalPage = totalPage;
var startPage = 1;
if (totalPage > 10) {
totalPage = 10;
if (currentPage > 6) {
totalPage = totalPage + (currentPage - 6);
startPage = 1 + (currentPage - 6);
if (totalPageTemp > totalPage) {
startPage = 1 + (currentPage - 6);
//console.log('ok '+startPage);
} else {
totalPage = totalPageTemp;
startPage = totalPageTemp - 10;
//startPage=1+(currentPage-6);
}
}
}
range = [];
for (var i = startPage; i <= totalPage; i++) {
range.push(i);
}
$scope.numOfPage = range;
}
});
}
}
};
&#13;
<div class="row e2e-details-scroll" ng-class="{'e2e-norecord-space': errorDetailMsg == true}">
<div class="col-md-12">
<table ng-if="!!DetailDetails" class="table table-bordered" id="e2e-detailsTable" datatable="ng" dt-options="configOption">
<thead class="thead-inverse">
<tr class="tableHeading" ng-repeat="data in DetailDetails.DATA | limitTo: 1">
<th class="detaildetalis-heading" table-filter tablename="e2e-detailsTable" ng-repeat="(key,value) in data "> {{"MESSAGE."+ key | translate}} </th>
</tr>
</thead>
<tbody>
<tr ng-repeat="data in DetailDetails.DATA">
<td class="detaildetalis-records" ng-repeat="(key,value) in data"> {{ value }} </td>
</tr>
</tbody>
</table>
<!-- .Table End -->
</div>
<!-- .col-md-12 End -->
</div>
&#13;