Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dspace7 Angular
Manage
Activity
Members
Labels
Plan
Issues
42
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vtechworks
Dspace7 Angular
Commits
ce004c2e
Commit
ce004c2e
authored
5 years ago
by
Giuseppe Digilio
Browse files
Options
Downloads
Patches
Plain Diff
Resolve conflict occurred when two or more pagination components are present in the same page
parent
4b67dbf1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/shared/pagination/pagination.component.ts
+28
-21
28 additions, 21 deletions
src/app/shared/pagination/pagination.component.ts
with
28 additions
and
21 deletions
src/app/shared/pagination/pagination.component.ts
+
28
−
21
View file @
ce004c2e
...
...
@@ -225,10 +225,14 @@ export class PaginationComponent implements OnDestroy, OnInit {
}
/**
* @param cdRef
* ChangeDetectorRef is a singleton service provided by Angular.
* @param route
* Route is a singleton service provided by Angular.
* @param router
* Router is a singleton service provided by Angular.
* @param hostWindowService
* the HostWindowService singleton.
*/
constructor
(
private
cdRef
:
ChangeDetectorRef
,
private
route
:
ActivatedRoute
,
...
...
@@ -243,7 +247,7 @@ export class PaginationComponent implements OnDestroy, OnInit {
* The page being navigated to.
*/
public
doPageChange
(
page
:
number
)
{
this
.
updateRoute
({
page
:
page
.
toString
()
});
this
.
updateRoute
({
pageId
:
this
.
id
,
page
:
page
.
toString
()
});
}
/**
...
...
@@ -253,7 +257,7 @@ export class PaginationComponent implements OnDestroy, OnInit {
* The page size being navigated to.
*/
public
doPageSizeChange
(
pageSize
:
number
)
{
this
.
updateRoute
({
page
:
1
,
pageSize
:
pageSize
});
this
.
updateRoute
({
pageId
:
this
.
id
,
page
:
1
,
pageSize
:
pageSize
});
}
/**
...
...
@@ -263,7 +267,7 @@ export class PaginationComponent implements OnDestroy, OnInit {
* The sort direction being navigated to.
*/
public
doSortDirectionChange
(
sortDirection
:
SortDirection
)
{
this
.
updateRoute
({
page
:
1
,
sortDirection
:
sortDirection
});
this
.
updateRoute
({
pageId
:
this
.
id
,
page
:
1
,
sortDirection
:
sortDirection
});
}
/**
...
...
@@ -273,7 +277,7 @@ export class PaginationComponent implements OnDestroy, OnInit {
* The sort field being navigated to.
*/
public
doSortFieldChange
(
field
:
string
)
{
this
.
updateRoute
({
page
:
1
,
sortField
:
field
});
this
.
updateRoute
({
pageId
:
this
.
id
,
page
:
1
,
sortField
:
field
});
}
/**
...
...
@@ -413,27 +417,30 @@ export class PaginationComponent implements OnDestroy, OnInit {
* Method to update all pagination variables to the current query parameters
*/
private
setFields
()
{
// (+) converts string to a number
const
page
=
this
.
currentQueryParams
.
page
;
if
(
this
.
currentPage
!==
+
page
)
{
this
.
setPage
(
+
page
);
}
// set fields only when page id is the one configured for this pagination instance
if
(
this
.
currentQueryParams
.
pageId
===
this
.
id
)
{
// (+) converts string to a number
const
page
=
this
.
currentQueryParams
.
page
;
if
(
this
.
currentPage
!==
+
page
)
{
this
.
setPage
(
+
page
);
}
const
pageSize
=
this
.
currentQueryParams
.
pageSize
;
if
(
this
.
pageSize
!==
+
pageSize
)
{
this
.
setPageSize
(
+
pageSize
);
}
const
pageSize
=
this
.
currentQueryParams
.
pageSize
;
if
(
this
.
pageSize
!==
+
pageSize
)
{
this
.
setPageSize
(
+
pageSize
);
}
const
sortDirection
=
this
.
currentQueryParams
.
sortDirection
;
if
(
this
.
sortDirection
!==
sortDirection
)
{
this
.
setSortDirection
(
sortDirection
);
}
const
sortDirection
=
this
.
currentQueryParams
.
sortDirection
;
if
(
this
.
sortDirection
!==
sortDirection
)
{
this
.
setSortDirection
(
sortDirection
);
}
const
sortField
=
this
.
currentQueryParams
.
sortField
;
if
(
this
.
sortField
!==
sortField
)
{
this
.
setSortField
(
sortField
);
const
sortField
=
this
.
currentQueryParams
.
sortField
;
if
(
this
.
sortField
!==
sortField
)
{
this
.
setSortField
(
sortField
);
}
this
.
cdRef
.
detectChanges
();
}
this
.
cdRef
.
detectChanges
();
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment