Skip to content

pagination all citizens#542

Open
bobatari wants to merge 2 commits intoProject-Sloth:mainfrom
bobatari:main
Open

pagination all citizens#542
bobatari wants to merge 2 commits intoProject-Sloth:mainfrom
bobatari:main

Conversation

@bobatari
Copy link
Copy Markdown

pagination wasnt pulling all citizens, this should update that.

citizens.lua pulls all players from db now. can only get players online with ps.getAllPlayers() but think it's bad idea?
now returns pages + data from db for citizens.
Epixx1337 added a commit to Epixx1337/ps-mdt that referenced this pull request Apr 14, 2026
- Return { data, total, totalPages, page, limit } from getCitizens callback
- Add total count query and ORDER BY lastname, firstname
- Fix v.id = _ bug (use ipairs index i instead)
- Client passes page number and re-fetches on page change
- Match server default perPage of 20
- Use total from server for accurate Pagination range display

Based on upstream PR Project-Sloth#542
page: citizenPage
}); // this shit makes the whole world go round

citizens = Array.isArray(result) ? result : []; // this shit shows you the world spinning
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this comment.

citizens = Array.isArray(result) ? result : [];
const result = await fetchNui(NUI_EVENTS.CITIZEN.GET_CITIZENS, {
page: citizenPage
}); // this shit makes the whole world go round
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this comment.

local result = safeQuery(query, { limit, offset })
if not result or #result == 0 then return {} end
if not result or #result == 0 then
return { --same shit different row
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this comment.

end

-- getCitizens - pulls citizens from database with pagination support
-- getCitizens - pulls citizens from database with pagination support - this shit is broken
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this comment.


-- getCitizens - pulls citizens from database with pagination support
-- getCitizens - pulls citizens from database with pagination support - this shit is broken
-- this shit is now fixed.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this comment.

Copy link
Copy Markdown
Member

@MonkeyWhisper MonkeyWhisper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants