Skip to content

createPageViewer

Zacharie edited this page Jul 24, 2023 · 1 revision

PynamicUI Wiki: createPageViewer Class

Introduction

The createPageViewer class is a significant addition to PynamicUI. It provides an easy and efficient way to manage dynamic lists or grids of elements in your user interface. The class simplifies adding, removing, and rendering items, contributing to a cleaner and more manageable code base.

Class Parameters

createPageViewer is instantiated with the following parameters:

  • dom: The application's DOM.
  • pageWidth: The number of elements in a row on the page.
  • pageLength: The number of elements per page.
  • container: The element container in which the page viewer will be placed.
  • previousPageButton: Button to navigate to the previous page.
  • nextPageButton: Button to navigate to the next page.
  • createItem: A function to create each item in the list.

Key Features

  • Dynamic Content Management: With createPageViewer, managing dynamic content becomes more convenient. You can easily add or remove items from your list or grid, and the viewer will automatically update to reflect these changes.

  • Pagination Support: createPageViewer supports easy navigation through your list or grid of elements. It includes functionality for next and previous page buttons, which will be enabled or disabled as necessary.

  • Custom Item Creation: The createItem function provides the flexibility to define the creation of each item in the list or grid. This allows for high customization of the elements within the viewer.

Example of Use

Refer to the example provided in the documentation for a demonstration of how to use createPageViewer in a Contact Manager application. In this example, the class is used to manage a dynamic list of contacts, each represented as a row in the viewer.


The createPageViewer class is a powerful tool for managing dynamic lists and grids in your PynamicUI application. Its flexibility and ease-of-use make it a crucial component in the PynamicUI toolset. For any issues or suggestions, please feel free to contribute to the project or contact the PynamicUI Development Team.