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

Jump to solution
jsimon3
Community Participant

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};
}
}));
});
...
Labels (1)
0 Likes
1 Solution
jsimon3
Community Participant

So yes I have, I can take care of everything on the backend. It's the front end where I was running into a little hiccup.

I solved the issue this morning where on page load I would get a count of the Nodelist `.ui-widget-content .slick-row` and if that count exceeds current count run four each again. Thanks carroll-ccsd‌. 

View solution in original post