What is the best practice for detecting page pagination? trigger/eventListener...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2019
12:08 PM
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};
}
}));
});
...
Solved! Go to Solution.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2019
01:11 PM
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.