Skip to content

Commit 4e720e3

Browse files
authored
Update paginated-data-server-script.js
better comments
1 parent 54a32a1 commit 4e720e3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Service Portal Widgets/Paginated Data/paginated-data-server-script.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
(function() {
2-
// Configuration: Fields for pagination
3-
data.recordsTable = 'task'; // The table name to query records from
2+
// Configuration
3+
data.recordsTable = 'task';
44
data.recordsQuery = ''; // The encoded query to filter records (empty means all records)
55
data.recordsFields = ['number', 'short_description']; // The fields to retrieve for each record
6-
data.recordsPerPage = 10; // Number of records to display per page
6+
data.recordsPerPage = 10;
77

88
// Get pagination parameters
99
data.page_id = $sp.getParameter('id');
1010
data.page = parseInt($sp.getParameter('page'), 10) || 1; // Current page number, default to 1
11-
data.display = parseInt(data.recordsPerPage, 10) > 0 ? parseInt(data.recordsPerPage, 10) : 10; // Ensure positive number of records per page
11+
data.display = parseInt(data.recordsPerPage, 10) > 0 ? parseInt(data.recordsPerPage, 10) : 10; // Amount of records to display per page
1212

1313
// Count total records
1414
var countGa = new GlideAggregate(data.recordsTable);
@@ -19,7 +19,6 @@
1919
data.count = parseInt(countGa.getAggregate('COUNT'), 10);
2020
}
2121

22-
// Calculate pagination details
2322
data.pages = calculatePaginationPages(data.count, data.display, data.page);
2423

2524
// Adjust current page if it exceeds the total number of pages

0 commit comments

Comments
 (0)