Data Label
Guide for using data labels in your applications
Last updated
Was this helpful?
Guide for using data labels in your applications
Last updated
Was this helpful?
Data Label is a label component based on a dataprovider value, that can show dynamic text and (optionally) an image.
The key differences between a Data Label and a Label and the main reasons for using Data Label instead of Label are the following:
Data Label supports format, which is very useful when it comes to displaying dates, numbers for example
The value displayed by the Data Label can be enhanced/transposed using a valuelist, which is used to get a display value for the actual columns real value like id -> name for example
To see a live sample of the component you can go .
Example:
imageStyleClass: fa fa-user
Example:
trailingImageStyleClass: fa fa-user-lock
For example, styleClass="label-info"
Example:
Let's consider a Data Label having requireddate
set as dataprovider, with no Format set:
We need the date to show the full name of the month, followed by day and full year, so we apply a Format, as shown below:
Here is how it looks after the Format has been set:
Example:
In order to get a drop down menu with orders' ship countries, the followings settings should be made:
Like most components, Data Labels have events, which allow you to execute some logic when something happens in the UI. Of course, the most common event for a data label is the onAction
event, which is triggered when the data label is clicked or the user hits the Enter
key while the data label has focus.
Data Labels, like many components, can be modified at runtime through code. Below are a few examples of controlling a Data Label from code.
You can easily change the enabled
state of a Data Label at runtime.
Example:
You can easily change the visible
state of a Data Label at runtime.
Example:
Like most components, a Data Label has API methods which can be called from code. Below is an example of common API calls.
Example:
The following articles are recommended for additional reading:
In the , drag the Data Label component from the Pallet onto the form, then select a dataprovider.
If the component does not appear in the pallet, it means you do not have the Bootstrap Components package installed. Click "Get more components" at the top of the pallet to open the and install it.
Data Labels, like all components, have properties that can be modified at design time to set the appearance and behavior of the component. Select the label in the to see a list of properties in the . Below are some common properties and how to set them at design time.
See the reference docs for for a complete list of its .
Data Label's dataprovider can be set after the component has been added to the form or by setting it in property, found in the .
Data Labels, like many components, can display tooltip messages when a user hovers their cursor, this can be done by modifying the property using the .
Many times, a data label will be decorated with an image or font icon. To add an image before the text of the data label, edit the property and choose the style class of the font icon you wish to use. For example, enter a value of fa fa-user
to get a nice icon that represents a User.
In the same way, there is a property to add an image or icon after the text of the data label.
For more information, please see the section of the guide on
Like all components, a Data Label can be styled using themes and raw CSS. To apply any available style class, simply enter one or more space-delimited values for the property.
Data Label's Format can be set in property. Depending on the type of each dataprovider, this will be done via the format editors for , , .
Data Label's can be set it in property, found in the and it should match the set .
set shipcountry
as the Data Label
in case it doesn't exist, create a using Table values and shipcountry
column as dataprovider
set the countries list in property of the Data Label
To Handle the event, double-click the value for the property in the . You will see the . You'll have the option to select an existing Method or create a new Method. The method will be called when the data label's onAction
event is fired and the object will be passed to it.
See the for a comprehensive list of
You can easily add a style class to a Data Label using the method.
See the for a complete list of programmable and .