AnsweredAssumed Answered

What is the best practice for detecting page pagination? trigger/eventListener...

Question asked by Jewell Simon on Oct 23, 2019
Latest reply on Oct 24, 2019 by Jewell Simon

So I am working on adding icons (accommodations) for each student in the gradebook next to the students name to make it easier for the teachers to help the students. (using customData bools)

My question is how do you all detect pagination? Is there a trigger or load that I can listen to and and rerun my forEach? 

...
students.forEach((student) => {
console.info(student);
let studentId = student.getAttribute('data-student_id');
const fetchUrl = `/api/v1/users/${studentId}/custom_data/user_accommodations?ns=accommodations`;
const options = {
'credentials': 'same-origin',
'headers': {
'accept': 'application/json'
},
'timeout': 5000
};
fetch(fetchUrl, options)
.then(response =>
response.json()
.then(data => ({
data: data,
ok: response.ok
})
).then(res => {
if (res.ok){
if(res.data.data.TTS){student.innerHTML += TTS};
if(res.data.data.HR){student.innerHTML += HR};
if(res.data.data.Calc){student.innerHTML += CALC};
if(res.data.data.SG){student.innerHTML += SG};
if(res.data.data.IND){student.innerHTML += IND};
if(res.data.data.STT){student.innerHTML += STT};
if(res.data.data.ET){student.innerHTML += ET};
if(res.data.data.PS){student.innerHTML += PS};
}
}));
});
...

Outcomes