EN | ES
The templates parameters are the parameters that will be required of the user of the template and will have to fill in when they are going to use it.
When filling in the form, the parameter will be replaced by the value selected for it.
To use them we will drag them to the text editor TEMPLATE CODE HTML & CSS (DROP ZONE). Since 2.1.3-gradius version also in Javascript section
Text Label Parameter:
This parameter will be replaced by the string that is written in the form when we use the template in the dashboard.
All these comments contain a name parameter to differentiate them from each other. We can also use the same comment in several code sites if we want to specify the same string in different parts of the code, not having to fill in several fields of the form that appears after selecting the template for its use.
Number Label Parameter:
This parameter will ask for a number in the form after selecting the template for its use.
Label with Datasource data:
This parameter is replaced by the value of the datasource that we select in the form.
Label with parameter name of Datasource:
This is replaced by the name of the field of the data source that we select in the form.
This is useful if in our html code we want to write the name of the data source parameter to use it.
For example, if we created a template where a graph was shown, in the values of the axes we could put this so that, in the previous form, we would choose which fields would show each axis.
Label to be loaded with the chosen value from a list:
In this we will save some options that the template user can then select and the selected option will be replaced by the comment
In the options field we will put the different options separated by commas.
We can test the template by accessing show gadget template where we can change the parameters by values and select a datasource to check if the template meets the requirements that are expected of it.
We will create an example template with parameters to see how to use them
For the example we will create a simple value gadget:
First step we go to the screen to create the template gadget.
We give an identifier a description.
We insert the code, which has a text type parameter and another Label type with a Datasource parameter name
<style> .card-count{ color: #2e43ab; font-weight: bold; font-size: -webkit-xxx-large; padding-left: 20px; } .card-title{ color: #000000; font-weight: bold; font-size: x-large; } .card-green{ color:green; } .my-card{ padding: 15px; } .card-icon{ padding-top: 0px; padding-left: 0px; padding-bottom: 25px; padding-right: 25px; } </style> <div class="my-card"> <md-icon class="card-icon" style="font-size:35px">assessment</md-icon> <label class="card-title"><!--label-osp name="title" type="text"--></label><br> <label class="card-count">{{ds[0].<!--label-osp name="ontology field" type="ds_parameter"-->}}</label> </div>
Save and go our dashboard.
We will drag the icon where we want our gadget to appear.
We select the template and we find a form to fill
After entering the datasource and the title text and selecting the value to display, we will see the gadget in our dashboard with this appearance: