Expert tip Implementing Pagination in Microsoft Power Apps
Microsoft Power Platform / November, 24 2023

Expert tip: Implementing Pagination in Microsoft Power Apps

Imagine loading all the listings under a category on your e-com platform on a single page. That feels like flooding the page, causing great inconvenience to your users. Also, the page will take more time to load, adding to your reader’s frustration. You need to organize content on your app to make it easy for your audience to access information. Pagination is one of the widely used ways to organize content for better usability and performance. In this article, we will discuss how to implement Pagination when building your app on Microsoft Power Apps.

Need for content organization

User experience is the X-factor for driving user adoption. Your app should be fluid, reducing cognitive load on your users. Let’s go back to the e-com example. You scroll through a thousand products on a single page to find the one you need. Could you locate it easily when you revisit the same page? Not unless you mark it as a favorite or added to cart. This would be a great inconvenience, wouldn’t it? If the listings are organized in different pages, you can locate it by the page number easily.

Well-organized content makes your app usable; usability improves user engagement and retention rate. Proper content organization reduces cognitive load on your users and improves their experience. This is where Pagination comes as an effective way to organize your content.

What is Pagination?

Pagination is a pattern that structures data into pages with numbering. Pagination reduces page load time and delivers a consistent user experience. Your users can easily navigate through your app or content. They can jump directly to the page they are looking for rather than scrolling through the entire content. Such a breezy experience helps you keep them engaged.

With Pagination, your app fetches only the required information at once. Thus, Pagination helps you save resources and network bandwidth, significantly improving the application performance.

Implementing Pagination in Power Apps

If you are building your application on Microsoft Power Apps, you can implement Pagination on your application with these simple steps.

Step 1: Open Power Apps Studio

  • To open Power Apps Studio from the Power Apps portal, go to https://powerapps.microsoft.com/ and sign in with your Microsoft account.

Step 2: Create a new Canvas App or edit an existing Canvas App

  • If you are creating a new Canvas app, click on the Create button and select Canvas app. Then, give your app a name and select a layout.
  • If you are editing an existing Canvas app, open the app in Power Apps Studio.

Step 3: Add a new screen to your Canvas App

  • To add a new screen to your Canvas app, click on the “+” button in the left-hand menu and select Screen.

Step 4: Use the following formula in the “OnVisible” property of the screen control:

  • Select the screen control for which you want to set the context variable.
  • In the right-hand properties pane, locate the “OnVisible” property.
  • Enter the following formula:  UpdateContext({varPageNumber:1});
Pagination-Step-4

Step 5: Add Gallery Control

  • Add a Gallery control to the screen.
  • Set the gallery’s items property to a data source.
  • In our scenario, we have used the table called “Projects” as our data source.
  • Rename the gallery as “galProjects”.
Pagination-Step-5

Step 6: Add Dropdown Control

  • The dropdown control serves as a user interface element that allows users to choose the number of rows, they want to display in the gallery control simultaneously.
  • Add the dropdown control and rename it as “drpPageSize”. You can move and resize it as per your design requirements.
  • Go to the “items” property. Define the number of rows you want to display, and the Gallery control will display the records accordingly. For example, [“5″,”10″,”15″,”20″,”25”].
Pagination-Step-6.1
  • Navigate to the “onChange” property and add the below mention code –

UpdateContext({varPageNumber:1});

Pagination-Step-6.2

Step 7: Add (Previous) Icon/Button Control

  • Add a button or icon and rename it as “Previous_Icon”.
  • Use the given formula below in the “OnSelect” property of the previous icon. This will be used to decrease the current page number.

UpdateContext({varPageNumber: varPageNumber – 1})

Pagination-Step-7.1
  • Use the given formula below in the “displayMode” property on the previous icon. This will be used to disable the icon if the current page number is 1.

If(varPageNumber = 1, DisplayMode.Disabled, DisplayMode.Edit)

Pagination-Step-7.2

Step 8: Add (Next) Icon/Button Control

  • Add a button or icon and rename it as “Next_Icon”.
  • Use the given formula below in the “OnSelect” property of the next icon to increment the current page number.

UpdateContext({varPageNumber: varPageNumber + 1})

Pagination-Step-8.1
  • Use the given formula below in the “displayMode” property on the previous icon. This will be used to disable the icon if the current page is the last page.

If(drpPageSize.Selected.Value * varPageNumber < CountRows(Projects), DisplayMode.Edit, DisplayMode.Disabled)

Pagination-Step-8.2

Step 9: Add a Label Control

  • Utilize the label control to showcase the current page number and total number of records/rows.
  • Add a new label control and rename it as “Sequence_Label” and use the below given formula in the “Text” Property of the label.

“Page : ” & If(RoundUp(CountRows(Projects)/ drpPageSize.Selected.Value,0)=0,0,varPageNumber)  & ” of ” & RoundUp(CountRows(Projects) / drpPageSize.Selected.Value,0)

Pagination-Step-9

Step 10: Filtering the Gallery Control

  • Filter the gallery component to display rows/records based on the pagination logic.
  • Use the below given formula in the “items” property of the gallery component.
Pagination-Step-10

Step 11: Save and publish the app to verify the changes

  • Save & publish the canvas app.
  • Play the app and check the new pagination system.

These simple steps will help you add Pagination to your application.

As a company, we are convinced that applications designed with a specific purpose can have a more significant and meaningful impact, surpassing the benefits of merely prioritizing the latest functionalities. Our approach involves meticulous crafting of applications on Power Platform, taking into account factors such as needs, adoption, return on investment (ROI), and user intuitiveness.

Saxon’s Power Platform experts are delivering meaningful outcomes in driving organization’s digital transformation journey. We help our customers build the most reliable and efficient solutions on Power Apps, improving their processes and productivity. From consulting to app development, we’ve got you covered. Get in touch with us now.

About the author

Palak Intodia

Senior Software Engineer at Saxon AI
Palak is a certified Power Apps developer with a passion for creating efficient and user-friendly cloud-based applications.

Follow us on LinkedIn and Medium to never miss an update.

Get in Touch

Newsletter

Stay up-to-date with our latest news, updates, and promotions by subscribing to our newsletter.

Microsoft Solutions Partner - Infrastructure (Azure)
Microsoft Solutions Partner - Modern Work
Microsoft Solutions Partner - Data & AI (Azure)
Microsoft Solutions Partner - Business Applications
Microsoft Partner Azure Expert MSP

Copyright Âİ 2008-2023 Saxon. All rights reserved | Privacy Policy

Address: 1320 Greenway Drive Suite # 660, Irving, TX 75038

Archana Aila

Archana Aila

Position Here

With 2 years of hands-on experience in Power Platform, I’ve excelled in developing and implementing solutions for businesses, harnessing the power of Power Apps, Power Automate, Power BI, and Power Virtual Agents to streamline processes and enhance productivity. My proficiency extends to crafting custom applications, automating workflows, generating data insights, and creating chatbots to aid operational efficiency and data-driven decision-making.

With an intermediate knowledge in Azure cognitive services, incorporating them into Power Platform use cases to innovate and solve complex challenges. My expertise in client engagement and requirements gathering, coupled with effective team coordination, ensures on-time, high-quality project deliveries. These efforts have yielded significant accomplishments, solidifying my role as a valuable asset in this field.

Palak Intodia

Palak Intodia

Position Here

I am a tech graduate with a strong passion for technology and innovation. With three years of experience in the IT industry, I’ve been on a continuous journey of professional growth and skill development. My expertise lies in Power Apps and Automate, where I’ve had the privilege of contributing to multiple successful projects.

I’m dedicated to delivering results that not only meet expectations but also drive the success of the projects I’m involved in. I’m committed to my ongoing professional development and the pursuit of excellence.

Roshan

Roshan Jaiswal

Position Here

With nearly 2 years of dedicated experience in Power Platform technology, my expertise lies in crafting customized business solutions using Power Apps and Power Automate. I excel in identifying intricate business requirements and translating them into innovative, user-friendly applications. My daily tasks involve meticulously deploying applications across diverse environments and harnessing the full potential of the Microsoft ecosystem within business applications.

I have proven my adaptability by consistently meeting the demands of creating responsive and scalable applications. Also seamlessly integrating complex workflows and data sources, ultimately enhancing operational efficiency and driving sustainable business growth.

Sugandha

Sugandha Chawla

Position Here

Sugandha is a seasoned technocrat and a full stack developer, manager, and lead. Having 8 years of industry experience, she has been able to build excellent working relationships with all her customers, successfully establishing repeat business, from almost all of them. She has worked with renowned giants like Infosys, Ernst & Young, Mindtree and Tech Mahindra.

She has very diverse and enriching work experience, having worked extensively on Microsoft Power Platform, .NET, Angular, Azure, Office 365, SQL. Her distinctiveness lies in the profound domain knowledge, managerial skills, and process mastery, that she additionally holds, as a result of possessing a customer facing role, working with different sectors, and managing and driving numerous critical executions, single-handedly, end to end.

Vibhuti Dandhich

Vibhuti Dadhich

Position Here

Vibhuti, a Power Platform technology evangelist, has passionately embraced the transformative potential of low-code development. With a background that includes experience at EY and Wipro, she’s been a trusted advisor for clients seeking innovative solutions. Her expertise in unraveling complex business challenges and crafting tailored solutions has propelled organizations to new heights.

Vibhuti’s commitment to staying at the forefront of technological advancements and her forward-thinking approach have solidified her as an industry thought leader. Her mission is to empower businesses to thrive in the digital age, revolutionizing operations through the Power Platform.

Ruturaj Kulkarni

Ruturaj Kulkarni

Position Here

With 8 years of dedicated expertise in the IT realm, I am a seasoned professional specializing in .NET technologies and Microsoft Azure Cloud. My journey encompasses a profound understanding of software development using the .NET framework and a robust command over Azure’s cloud ecosystem. Throughout my career, I’ve demonstrated a knack for crafting scalable and efficient solutions, leveraging the power of cloud computing.

My passion lies in staying at the forefront of technological advancements, ensuring that my skills align seamlessly with the dynamic landscape of IT. Ready to tackle challenges and drive innovation, I bring a wealth of experience to any project or team.