web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Page number goes haywi...
Power Apps
Unanswered

Page number goes haywire when filter is selected

(0) ShareShare
ReportReport
Posted on by 603

I have a powerapps gallery with SharePoint as the backend. I have pagination implemented in the gallery as per below screenshot. 

 

Iantaylor2050_0-1708488053543.png

 

When i am on 12th page and i select Division filter from the top right, the page number goes haywire as per screenshot below.

Iantaylor2050_1-1708488361487.png

Iantaylor2050_2-1708488494074.png

 

It says Page 12 of 3 page(s) which is wrong. Once i click on the first page icon (i.e. less than symbol), it resets back to normal as per below. May i know how to avoid Page 12 of 3 page(s)?

 

Iantaylor2050_3-1708488767559.png

 

 

Categories:
I have the same question (0)
  • cdwhite Profile Picture
    1,069 Most Valuable Professional on at

    Hi @Iantaylor2050 ,

    What is the Power Fx code behind showing the 'Page x of x'? It seems to me like a variable not updating when it needs to.

  • Iantaylor2050 Profile Picture
    603 on at

    Hi @cdwhite , @WarrenBelz , All

     

    Below is the piece of code for implementing page numbers in gallery. Currently the page number goes haywire when filter is selected as per screenshot below

     

    Iantaylor2050_0-1708932123508.png

     

    Once i click on the first page icon (i.e. less than symbol), it resets back to normal as per below. May i know how to avoid Page 12 of 3 page(s)?

     

    Iantaylor2050_1-1708932190328.png

     

     

     

    Main Gallery code

    If(
    icoNext_user.DisplayMode = DisplayMode.Disabled,
    // Handling last set of records
    LastN(
    FirstN(
    galHidden_user.AllItems,
    drpPaginationSize_user.Selected.Value * varPageNumber_user
    ),
    drpPaginationSize_user.Selected.Value - (drpPaginationSize_user.Selected.Value * varPageNumber_user - CountRows(galHidden_user.AllItems))
    ),
    LastN(
    FirstN(
    galHidden_user.AllItems,
    drpPaginationSize_user.Selected.Value * varPageNumber_user
    ),
    drpPaginationSize_user.Selected.Value
    )
    )

    Hidden Gallery Code

    With(
     {
     _Data: Filter(
     'Data Source',
     (Len(ComboBox1_6.Selected.Value) = 0 || Er_Type.Value = ComboBox1_6.Selected.Value) && (Len(ComboBox1_7.Selected.Value) = 0 || Status = ComboBox1_7.Selected.Value)
     )
     },
     SortByColumns(
     Filter(
     _Data,
     (User().Email in Team_Members.Email || 'Created By'.Email = User().Email) && (Len(TextInput2_3.Text) = 0 || TextInput2_3.Text in Er_Type.Value || TextInput2_3.Text in Submission_Id || TextInput2_3.Text in 'Er Title' || TextInput2_3.Text in Team_Members.DisplayName || TextInput2_3.Text in Status||TextInput2_3.Text in Submission_Date)
     ),
     varsortcolumn,
     varsortdirection
     )
    )

    Page Number Label Text Property

    "Page " & varPageNumber_user & " of " & If(
    Mod(
    CountRows(galHidden_user.AllItems),
    100
    ) = 0,
    RoundUp( CountRows(galHidden_user.AllItems) / drpPaginationSize_user.SelectedText.Value ,0) & "+ pages",
    RoundUp( CountRows(galHidden_user.AllItems) / drpPaginationSize_user.SelectedText.Value,0) & " page(s)"
    )

    Arrow Left OnSelect

    Set(varPageNumber_user,varPageNumber_user-1)

    Arrow Right OnSelect

    Set(varPageNumber_user,varPageNumber_user+1)

    Left icon (less than symbol) OnSelect

    Set(varPageNumber_user,1)

     Right icon (Greater than symbol) OnSelect

    Set(varPageNumber_user, RoundUp( CountRows(galHidden_user.AllItems) / drpPaginationSize_user.SelectedText.Value ,0) )

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 339 Most Valuable Professional

#2
11manish Profile Picture

11manish 180

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 88 Super User 2026 Season 1

Last 30 days Overall leaderboard