Accordion Panel
Last updated
Last updated
The AccordionPanel component is a container similar to a TabPanel, but instead of having tabs for showing / hiding forms, it has buttons that behave like an accordion, moving one way or the other.
It can hold one or more forms. But only one of them is visible at a time. The active/visible form can be changed via button clicks or from code. Forms can be added and removed both at design-time and at runtime. Child forms can optionally show data through a relation.
It can be used in both responsive and anchored layouts.
Here are the steps for creating an Accordion Panel:
Find AccordionPanel in Form Containers section in the components' pallet
Drag and drop the Accordion Panel component in the desired place of the form
It is recommended to set a specific name
in the Accordion Panel properties in order to make it easier to use it later in scripting.
Example: "accordionpanel_orders"
.
It is recommended to set a specific name
in the Accordion Panel tab properties in order to make it easier to use them later in scripting.
Example: "tab_customers"
.
After dragging the container in the form, the Property configurator for tabs
wizard appears. In order to set the tabs using the wizard, you need to do the following steps:
Find in the left side of the wizard the contained form you need: it can have a related or unrelated datasource
Click on the form name
The selected form will appear on the right side of the wizard, showing some of the tab properties:
CONTAINEDFORM
: the form shown in the tab
RELATIONNAME
: the name of the relation between datasources of main and contained forms; this field will be empty if the relation doesn't exist
delete
icon : you can remove a tab by clicking the icon
Click OK
button after all tabs have been added
After dragging the container in the form, the Property configurator for tabs
wizard appears. Close the editor without setting anything here, find the Accordion Panel in the form editor, click it and proceed with the following steps:
Add a tab. There are 2 ways of adding a tab:
Drag and drop tab
component (of an AccordionPanel in Form Containers section in the components' pallet) into the AccordionPanel container (in the form editor)
In order to edit each tab, expand it or click the tab name in the AccordionPanel container (in the form editor) and set the properties:
The contained form of the tabs can show related data. In order to do this, you need to have the following:
Once everything is set, the contained form will show related data according to the selected record in the main form. When the selected record changes in the main form, so will the related data from the contained form.
Examples:
Example:
In order for the custom HTML content to be correctly displayed we need to make sure that it will not be sanitized by using .putClientProperty(UICONSTANTS.TRUST_DATA_AS_HTML,true)
Only enable this setting if the data shown can always be trusted and is never composed of data from an external system or user.
Saving the active tab index in the onChange
event(fired after a different tab is selected) of the AccordionPanel container:
Checking if there is a saved previous active tab index and set it in the onShow
main form event:
Open the of the form where you need to place an Accordion Panel
Set the tabs; this can be done via or in the
Edit other if needed
TEXT
: the tab's title text ( and custom HTML supported)
Select the property and click the +
button in order to add a tab. Next tabs can be added the same way or by clicking the +
button (insert a new array item below
) of another tab. You can change the tabs' order by dragging them into the desired placed inside the Accordion Panel (in the form editor).
Expand the property to see the list of tabs. They are also shown in the AccordionPanel container (in the form editor)
: the form shown in the tab
: whether that tab is enabled or not
: a name for this tab
: optional relation for the form to be shown
: the tab's title text ( and custom HTML supported)
Set the property on the main form
Set the property on the contained form
Make sure that the from datasource table of the main form to datasource table of the contained form exists, otherwise it needs to be created
Set the above relation in the property of the corresponding tab
Tab's title property can be set by entering a value in the property field or by entering the . Usually this will be plain text or it can contain data from table columns, aggregations, calculations, relations or from and scopes variables, all of them can be combined, as well. is also supported.
Tab's title property supports custom HMTL content.
can be also set in the . You can find a list of AccordionPanel API methods .
Here is an example of how to programmatically set the active tab in the of the main form:
Here is an example of how to programmatically add a tab in the of the main form:
Here is an example of how to programmatically remove a tab in the of the main form:
Here is an example of how to enable and disable a tab in the of the main form:
Here is an example of how to use the of an AccordionPanel in the of the main form:
tabs
tabs
containedForm
disabled
name
relationName
text
relationName
onChange
event