Skip to content

Commit

Permalink
first attempt to implement pagination"
Browse files Browse the repository at this point in the history
  • Loading branch information
ejhon1116 committed Nov 14, 2024
1 parent 4839c55 commit 63c9f5a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
10 changes: 9 additions & 1 deletion pc-parts/part_fetch_show.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ function generateTable(items, priceLimit, nameFilter, typeBlacklist, brandBlackl


// Table Creation
items.forEach(item => {
i = 0;
items.every(item => {
if (parseFloat(item.price) <= priceLimit && item.name.toLowerCase().includes(nameFilter.toLowerCase()) && !typeBlacklist.includes(item.type) && !brandBlacklist.includes(item.brand)) {
if(i > 10) {
return false;
}
const row = document.createElement('tr');

const type = document.createElement('td');
Expand Down Expand Up @@ -52,6 +56,8 @@ function generateTable(items, priceLimit, nameFilter, typeBlacklist, brandBlackl
tableBody.appendChild(row);

odd = !odd;
i++;
return true;
}
});
}
Expand Down Expand Up @@ -178,6 +184,8 @@ async function initPage() {
const items = await fetchItems();
sortItems(items);

num_items = items.length


const price_limit_input = document.getElementById('price-limit-input');
price_limit_input.addEventListener('input', function() {
Expand Down

0 comments on commit 63c9f5a

Please sign in to comment.