[Trunk | Admin]: div-help-contents.component & page-help-contents.component: Bug fix: Show contents properly. Iterate from end to start and unshift in checkboxes at first parsing to show them in correct order.
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@56780 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
3ce70831aa
commit
80ec909e4d
|
@ -144,15 +144,15 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
this.counter.all = this.divHelpContents.length;
|
||||
this.checkboxes = [];
|
||||
|
||||
//for (let i = this.divHelpContents.length - 1; i >= 0; i -= 1) {
|
||||
for (let i = 0; i < this.divHelpContents.length; i++) {
|
||||
for (let i = this.divHelpContents.length - 1; i >= 0; i -= 1) {
|
||||
//for (let i = 0; i < this.divHelpContents.length; i++) {
|
||||
let divId: DivId = this.divHelpContents[i].divId as DivId;
|
||||
let pages: Page[] = divId.pages as Page[];
|
||||
const pageIds = pages.map(x => x._id);
|
||||
|
||||
if(!this.selectedPageId || pageIds.includes(this.selectedPageId)) {
|
||||
this.cutContent(this.divHelpContents[i]);
|
||||
this.checkboxes.push(<CheckDivHelpContent>{divHelpContent : this.divHelpContents[i], checked : false});
|
||||
this.checkboxes.unshift(<CheckDivHelpContent>{divHelpContent : this.divHelpContents[i], checked : false});
|
||||
} else {
|
||||
this.divHelpContents.splice(i, 1);
|
||||
}
|
||||
|
|
|
@ -156,12 +156,12 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
this.counter.all = this.pageHelpContents.length;
|
||||
this.checkboxes = [];
|
||||
|
||||
//for (let i = this.pageHelpContents.length - 1; i >= 0; i -= 1) {
|
||||
for (let i = 0; i < this.pageHelpContents.length; i++) {
|
||||
for (let i = this.pageHelpContents.length - 1; i >= 0; i -= 1) {
|
||||
//for (let i = 0; i < this.pageHelpContents.length; i++) {
|
||||
let page: Page = this.pageHelpContents[i].page as Page;
|
||||
if(!this.selectedPageId || (page._id == this.selectedPageId)) {
|
||||
this.cutContent(this.pageHelpContents[i]);
|
||||
this.checkboxes.push(<CheckPageHelpContent>{pageHelpContent : this.pageHelpContents[i], checked : false});
|
||||
this.checkboxes.unshift(<CheckPageHelpContent>{pageHelpContent : this.pageHelpContents[i], checked : false});
|
||||
} else {
|
||||
this.pageHelpContents.splice(i, 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue