final page handling changes
This commit is contained in:
parent
8d6df43faa
commit
03aa2e6a8c
|
@ -1,5 +1,5 @@
|
|||
<div class="ui-g dynamic-formc full-width full-height">
|
||||
<ng-sidebar-container>
|
||||
<ng-sidebar-container contentClass="scrollableContent">
|
||||
<ng-sidebar mode="push" position="right" [(opened)]="visibleSidebar">
|
||||
<table-of-content class="toc-container full-height" [model]="dataModel"></table-of-content>
|
||||
</ng-sidebar>
|
||||
|
|
|
@ -96,19 +96,13 @@ export class DynamicFormComponent implements OnInit {
|
|||
this.progressbar = true;
|
||||
|
||||
this.route.fragment.subscribe((fragment: string) => {
|
||||
if (fragment && document.querySelector('#' + fragment)) {
|
||||
;//this.adjustScrolling(<HTMLElement>document.querySelector('#' + fragment));
|
||||
// this.visibleSidebar = true;
|
||||
}
|
||||
//if (fragment)
|
||||
this.scrollTo(fragment);
|
||||
});
|
||||
|
||||
|
||||
this.route.queryParams.subscribe((params) => {
|
||||
if (params && "page" in params && !isNaN(params["page"]))
|
||||
{
|
||||
var page = Number.parseInt(params["page"]);
|
||||
this.currentPageIndex = this.pages.indexOf(page);
|
||||
}
|
||||
//this.visibleSidebar = true;
|
||||
if (params && "page" in params)
|
||||
this.changeCurrentPage(params["page"]);
|
||||
});
|
||||
},
|
||||
error => {
|
||||
|
@ -161,9 +155,23 @@ export class DynamicFormComponent implements OnInit {
|
|||
this.router.navigate([this.route.snapshot.url[0] + "/" + this.route.snapshot.url[1]], { queryParams: { page: this.pages[index] } });
|
||||
}
|
||||
|
||||
adjustScrolling(topElement: HTMLElement) {
|
||||
var scrollElement = document.querySelector('#scrollContainer').parentElement;
|
||||
scrollElement.scrollTop = topElement.offsetTop;
|
||||
scrollTo(sectionID: string) {
|
||||
if (!sectionID) return;
|
||||
var element = document.querySelector('#' + sectionID);
|
||||
if (!element) return;
|
||||
element.scrollIntoView();
|
||||
// this.visibleSidebar = true;
|
||||
//var scrollElement = document.querySelector('.scrollableContent');
|
||||
//scrollElement.scrollTop = topElement.offsetTop;
|
||||
}
|
||||
|
||||
changeCurrentPage(pageString: string) {
|
||||
if (!pageString) return;
|
||||
var page = parseInt(pageString);
|
||||
if (isNaN(page)) return;
|
||||
var pageIndex = this.pages.indexOf(page);
|
||||
if (pageIndex === -1) return;
|
||||
this.currentPageIndex = pageIndex;
|
||||
}
|
||||
/* scrollToElemID(elemID) {
|
||||
scroll("#" + elemID);
|
||||
|
|
Loading…
Reference in New Issue