Skip to content

Commit

Permalink
Do not run move of new pagination and remove of old one when new one …
Browse files Browse the repository at this point in the history
…is present

When more than one pagination in angular is present remove left overs
  • Loading branch information
karelhala committed Jun 16, 2017
1 parent 5eaf744 commit bcfed18
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions app/assets/javascripts/controllers/report_data_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,6 @@
angular.element(mainContent).addClass('miq-list-content');
}
}

var pagination = this.$document.getElementsByClassName('miq-pagination');
if (pagination && pagination.length > 0 && ! viewType) {
pagination[0].parentNode.removeChild(pagination[0]);
}
};

ReportDataController.prototype.activateNodeSilently = function(itemId) {
Expand All @@ -363,7 +358,14 @@
$('table td.narrow').addClass('table-view-pf-select').removeClass('narrow');
var pagination = this.$document.getElementsByClassName('miq-pagination');
var pagingDiv = this.$document.querySelector('#paging_div');
if (pagination && pagination.length > 0 && pagingDiv) {
//If more than one angular pagination is present remove some left overs.
if (pagination.length !== 1) {
$(pagination).each(function(index, item) {
//keep the first one
index !== 0 && item.remove();
});
}
if (pagination && pagination.length > 0 && pagingDiv && $(pagingDiv).find(pagination).length !== 1) {
var oldPagination = pagingDiv.querySelector('div');
oldPagination ? oldPagination.remove() : null;

Expand Down

0 comments on commit bcfed18

Please sign in to comment.