File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Service Portal Widgets/Paginated Data Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 3
3
data . recordsTable = 'task' ;
4
4
data . recordsQuery = '' ; // The encoded query to filter records (empty means all records)
5
5
data . recordsFields = [ 'number' , 'short_description' ] ; // The fields to retrieve for each record
6
- data . recordsPerPage = 10 ;
6
+ data . recordsPerPage = parseInt ( $sp . getParameter ( 'display' ) ) || 10 ;
7
+ data . userQuery = $sp . getParameter ( 'query' ) ;
7
8
8
9
// Get pagination parameters
9
10
data . page_id = $sp . getParameter ( 'id' ) ;
13
14
// Count total records
14
15
var countGa = new GlideAggregate ( data . recordsTable ) ;
15
16
countGa . addEncodedQuery ( data . recordsQuery ) ;
17
+ countGa . addEncodedQuery ( data . userQuery ) ;
16
18
countGa . addAggregate ( 'COUNT' ) ;
17
19
countGa . query ( ) ;
18
20
if ( countGa . next ( ) ) {
34
36
data . records = [ ] ;
35
37
var recordsGr = new GlideRecord ( data . recordsTable ) ;
36
38
recordsGr . addEncodedQuery ( data . recordsQuery ) ;
39
+ recordsGr . addEncodedQuery ( data . userQuery ) ;
37
40
recordsGr . chooseWindow ( data . rowStart , rowEnd ) ;
38
41
recordsGr . query ( ) ;
39
42
while ( recordsGr . next ( ) ) {
Original file line number Diff line number Diff line change 7
7
< nav aria-label ="Page navigation " ng-if ="data.count > 0 ">
8
8
< ul class ="pagination ">
9
9
< li class ="page-item ">
10
- < a class ="page-link " href ="?id={{data.page_id}}&page={{data.page-1}} " aria-label ="Previous " ng-if ="data.page > 1 ">
10
+ < a class ="page-link " href ="?id={{data.page_id}}&page={{data.page-1}}&display={{data.display}}&query={{data.userQuery}} " aria-label ="Previous " ng-if ="data.page > 1 ">
11
11
< span aria-hidden ="true "> «</ span >
12
12
< span class ="sr-only "> Previous</ span >
13
13
</ a >
16
16
< span class ="sr-only "> Previous</ span >
17
17
</ a >
18
18
</ li >
19
- < li class ="page-item " ng-repeat ="page in data.pages track by $index " ng-class ="{active: page == data.page} "> < a class ="page-link " href ="?id={{data.page_id}}&page={{page}} " ng-if ="page != '...' "> {{page}}</ a > < span ng-if ="page == '...' "> ...</ span > </ li >
19
+ < li class ="page-item " ng-repeat ="page in data.pages track by $index " ng-class ="{active: page == data.page} "> < a class ="page-link " href ="?id={{data.page_id}}&page={{page}}&display={{data.display}}&query={{data.userQuery}} " ng-if ="page != '...' "> {{page}}</ a > < span ng-if ="page == '...' "> ...</ span > </ li >
20
20
< li class ="page-item ">
21
- < a class ="page-link " href ="?id={{data.page_id}}&page={{data.page+1}} " aria-label ="Next " ng-if ="data.page < data.pages[data.pages.length - 1] ">
21
+ < a class ="page-link " href ="?id={{data.page_id}}&page={{data.page+1}}&display={{data.display}}&query={{data.userQuery}} " aria-label ="Next " ng-if ="data.page < data.pages[data.pages.length - 1] ">
22
22
< span aria-hidden ="true "> »</ span >
23
23
< span class ="sr-only "> Next</ span >
24
24
</ a >
You can’t perform that action at this time.
0 commit comments