Page Elements
Last updated
Last updated
Page elements are modular code blocks of dynamic page content written in Razor syntax. A page element by definition belongs to a single page.
The Page Elements feature in the ComUnity Toolkit empowers developers with a customisable utility to create tailored page components that meet specific requirements. These versatile tools facilitate the implementation of CRUD (Create, Read, Update, Delete) functionality within custom website pages. By seamlessly interacting with the Data service, developers can manipulate and dynamically display data within their web pages.
To access the page settings and leverage the Page Elements, follow these steps:
Open your project in the ComUnity Toolkit and navigate to the Custom Website section.
Select the Pages tab to view a comprehensive list of all existing pages within your Custom Website.
Choose the specific page you want to customise, and an array of icons will be displayed.
Locate and click the icon associated with that page.
A modal window titled Add a Page Element will appear on your screen.
In the modal window, provide a name for the page element and select the desired type. You can choose between two available types: Element and Form Element
Form elements are designed to facilitate the posting of form-related data to the platform. However, it is worth noting that this feature is currently underutilised, and may require removal. As a best practice, use Elements for all form-related tasks.
After successfully creating the page element, it will be added to the page hierarchy.
Select the created page element to build and configure its settings. This action will reveal a pop-up screen dedicated to customising the page element's specific settings.
Page Element Settings in the ComUnity Developer Toolkit offer developers the ability to fine-tune and customise various aspects of their page elements. These settings play a crucial role in configuring the behaviour and display of dynamic content within web pages.
In order to explore these settings in detail, developers can refer to the comprehensive guide on Dynamic List Rendering in a Navigation Page, which provides in-depth information and examples. This guide covers essential topics related to Page Element Settings, including the properties and their functionalities.
Let's explore the details of the individual Page Element Settings:
This property displays the name of your page element.
This property allows you to define a unique name that serves as a reference when templating your page element into a page. Refer to Templating Page Elements for further details.
This property is used to define the resource path of an OData URL.
This property is used to define the query options of an OData URL.
The Sort Order determines the ordering of the data as specified on the Data Path. It functions similarly to platform data queries. You can specify a comma-separated list of fields that you want to sort on. For example, "Name, Surname desc, DateOfBirth".
The Max Items property is used to specify a limit on the number of records to display on the client.
Pagination is not yet supported.
The payload that is returned by the oData URL you defined in your Data Path and Query is referenced to as Model
in your content definition.
The code samples shown below show a Data Path and Query used to fetch data from the BaseNotification entity in the Data Service and the Content definition written using Razor syntax shows logic for iterating over the payload referenced to as Model
and then displaying the outcome on the web using markup:
Data Path
Query
Content definition in Razor syntax
By understanding and configuring these various Page Element settings, you can customise and optimise the behaviour and display of your page elements within the ComUnity Developer Toolkit.