Skip to content

Instantly share code, notes, and snippets.

@bdogan
Created November 17, 2018 13:59
Show Gist options
  • Save bdogan/c7db4de4814924847853dff3c3c33315 to your computer and use it in GitHub Desktop.
Save bdogan/c7db4de4814924847853dff3c3c33315 to your computer and use it in GitHub Desktop.
Pagination const width
Dim pLastPage : pLastPage = gelen_sayfa_sayisi
Dim oCurrentPage : oCurrentPage = gelen_secili_sayfa
Dim oPagesWidth, oPageCursor : oPagesWidth = 4 : oPageCursor = 1
Dim oPageStart : oPageStart = oCurrentPage - oPagesWidth
Dim oPageEnd : oPageEnd = oCurrentPage + oPagesWidth
If (oPageStart <= 0) Then oPageEnd = oPageEnd - (oPageStart - 1) : oPageStart = 1
If (oPageEnd > pLastPage) Then oPageStart = oPageStart - (oPageEnd - pLastPage) : oPageEnd = pLastPage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment