Skip to content

Commit 99d4b43

Browse files
murhum1ihalaij1
authored andcommitted
Save participants page length to localstorage
Fixes #1486
1 parent 5976c47 commit 99d4b43

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

assets/js/participants.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,10 @@ function participants_list(participants, api_url, is_teacher, enrollment_statuse
514514
columns: columns,
515515
order: [[ is_teacher ? 1 : 0, 'asc' ]],
516516
orderCellsTop: true,
517+
stateSave: true,
518+
stateSaveCallback: function(settings, data) {
519+
localStorage.setItem('participantsListPageLength', data.length);
520+
},
517521
rowId: function(row) { return 'participant-' + row.user_id; },
518522
headerCallback: function(thead /*, data, start, end, display */) {
519523
// Ensure thead has id and filters row exists even if DT rebuilt the header
@@ -554,7 +558,7 @@ function participants_list(participants, api_url, is_teacher, enrollment_statuse
554558
$(row).attr('data-user-id', data.user_id);
555559
},
556560
lengthMenu: [[10, 50, 100, 500, -1], [10, 50, 100, 500, 'All']],
557-
pageLength: 50,
561+
pageLength: localStorage.getItem('participantsListPageLength') ? parseInt(localStorage.getItem('participantsListPageLength'), 10) : 50,
558562
deferRender: true,
559563
autoWidth: false,
560564
language: { url: pageLanguageUrl },

course/templates/course/staff/participants.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
{% endif %}
7171
</p>
7272

73-
<div id="participants-table-container" class="table-responsive">
73+
<div id="participants-table-container" class="table-responsive" style="overflow-x: visible;">
7474
<table id="table-participants" class="table table-sm">
7575
<thead id="table-heading"></thead>
7676
<tbody id="participants">

0 commit comments

Comments
 (0)