Modules Dynamic items Entity properties - happy-geeks/wiser GitHub Wiki
In this part we will describe all the different options of an entity-property. The entity-properties are all saved in the table 'wiser_entityproperty
'. Within the user interface of Wiser (the front-end project) Wiser extensively depends on the commercial framework Kendo UI from Telerik. So if you want to use Wiser you should buy a licence for this UI framework or alter Wiser to work with another or your own UI framework for the different field types. Some field types are easy (like input-fields) but other offer extensive capabilities like tables or data-pickers. We added custom functionality for most of the on Kendo-UI based components offered in Wiser and this custom functionality is described in this article. But you can also use other (non-described) standard functionality of the Kendo Components, for more information on Kendo UI see the Kendo website.
Below are the different settings of an entity-property in Wiser, these settings all correspondent with a column in the wiser_entityproperty table of Wiser:
Basic settings
Column | Default value | Explanation |
---|---|---|
entity_name |
The name of the entity type to which this field belongs. | |
link_type |
0 | If this is a field belonging to a link between 2 items, you must enter the type number of that link here. Note: entity_name should then be left blank. |
inputtype |
input | The type of field, see the fields section for all options and explanations of each field |
display_name |
The title of the field as shown in Wiser. So this is what the user sees. | |
property_name |
The name of the field as it should be stored in the database (in the wiser_item details table). If this value is empty, the display_name is used. | |
default_value |
The default value of the field as filled for new items the first time they are saved (note: not upon creation of a new item!). With input type "Empty" HTML can be placed here, which should be shown in the "empty" block. | |
language_code |
If there are multiple languages in which a property of an entity must be stored, the language code can be entered here. The property_name for each language is then the same, but the language_code should be filled differently for each language. This is ultimately also stored in the table wiser_itemdetail, where there is a UNIQUE INDEX on item_id, key, and language_code, making this possible. | |
ordering |
Determines the location of this field among all others; this is the default order in which the fields are displayed. This order also determines the order of the tabs; the fields are loaded in the specified order and the first time a new 'tab_name' occurs, it is created. |
Properties that determine how data in this field is saved
Column | Default value | Explanation |
---|---|---|
enable_aggregation |
0 | Set to 1 to ensure that the value of this field is also stored in an aggregation table. When an entity has this enabled for 1 or more fields, Wiser - when an item of this type is created or modified - automatically creates an aggregation table for that entity type, if it does not already exist. By default, this table is called aggregate_[entity type] . For more information, see Handling Wiser items (TODO). These aggregation tables have as purpose that information can be read fast without having to join all different separate values from the original key/value based wiser_itemdetail table. |
aggregate_options |
In JSON format, this is where additional options for aggregation of this field are defined. For more information, see Handling Wiser items (TODO) | |
also_save_seo_value |
0 | Set this value to 1 if you also need the search engine friendly variant for the value of the field in question (i.e. the lower-case value without punctuation). When this is set, an extra line is added to wiser_item detail or wiser_itemlinkdetail with the original property_name + _SEO as key. The value then contains the value you can use directly in a URL, for example. |
Properties that determine the Lay-out
Column | Default value | Explanation |
---|---|---|
width |
0 | The width of the field in percentage of the available window. So 100 = full width. |
height |
0 | De hoogte van het veld in pixels. |
tab_name |
The name of the tab in which this field should be shown. Leave blank to show the field in the default "Gegevens" tab. | |
group_name |
This column is used for grouping fields. | |
explanation |
The explanation for a field, to explain to the user what they should fill there. This explanation is displayed below each field by default, if filled, but can also be displayed as a popout, which is configurable via the property 'extended_explanation'. | |
extended_explanation |
0 | Set this value to 1 when this field needs a longer explanation (generally we mean more than 1 sentence). The explanation is then no longer shown below the field, but this field will get an info-icon and if the user clicks on it, this information will be shown on the right side of the screen. |
label_style |
normal | The way the label is displayed. Has one of these possible values:
|
label_width |
The width of the label. Used only when label_style is set to inline . |
|
css |
Allows you to add custom CSS to the field. |
Functionality properties
Column | Default value | Explanation |
---|---|---|
mandatory |
0 | Enter 1 here if the field is required to be filled. The user will then get an error message on save if they did not fill the field. |
readonly |
0 | Enter 1 here if the value of the field should not be modified by the user. |
regex_validation |
Here you can enter a regular expression (see regex101) that should validate the entered value of the field. If the entered value does not pass this, the user gets an error message when saving. | |
save_on_change |
0 | If set to 1, an item is saved immediately after adjusting the value of this field. |
access_key |
The keyboard shortcut that allows the user to bring the focus to this field. | |
visible_in_overview |
0 | Set this value to 1 if this field should also be included by default in summary tables of this entity. |
overview_width |
100 | The width (in pixels) of the column in a summary table, if this field is shown in such a grid (via visible_in_overview). |
Advanced and/or specific properties
Column | Default value | Explanation |
---|---|---|
options |
Here a JSON object can be filled with specific settings for this field. See the Fields section for more information and examples. Note that this must be valid JSON; for example, all properties must have double quotes around the name, example: { "mode": 3 }. | |
data_query |
Some field types (such as a combobox and a grid) load data. This can also be data from the result of a specific SQL query. This query can be filled here. It is recommended not to use this anymore, possibly this column will be removed in the future. The best approach is to fill the query in the table wiser_query and then enter the ID in the settings of this field. See the explanation of the respective fields types for more information. |
|
action_query |
This is used for field type action-button, here a query can be entered that should then be executed when that button is clicked. It is recommended not to use this anymore, possibly this column will be removed in the future. The best approach is to fill the query in the table wiser_query and then enter the ID in the settings of this field. See the explanation of the respective fields types for more information. |
|
search_query |
This is used for fields of the sub-entities-grid or grid type. For those fields, a button can be added which opens a popup in which to search for items to link. The query for that can be filled here. See the chapter on grid fields for more information. |
|
search_count_query |
This column goes together with search_query , this should basically contain the same query, but without a limit and with a count , so that the grid knows how many items there are in total. |
|
grid_delete_query |
This is used with grid and sub-entities-grid . If a custom query needs to be run to remove an item, it can be populated here. See the explanation of the grid field for more information. |
|
grid_insert_query |
This is used with grid and sub-entities grid. If a custom query needs to be run to add an item, it can be populated here. See the explanation of the grid field for more information. | |
grid_update_query |
This is used with grid and sub-entities grid. If a custom query needs to be run to modify an item, it can be populated here. See the explanation of grid field for more information. | |
custom_script |
Hier kan custom JavaScript voor het veld gevuld worden. Zie het hoofdstuk Custom scripts TODO voor meer informatie. | |
visibility_path_regex |
A regular expression executed on the full path of the item as it appears in Wiser's tree, provided the item is opened in a hierarchical module. If the path matches the regular expression, the field is shown, otherwise it is hidden. Used only for items opened via Wiser's tree. If an item is opened in any other way, the field will always be visible regardless of what is entered here (provided the user has the appropriate permissions to see the field). |
|
module_id |
0 | The ID of the module. |
automation |
Dependencies
Column | Default value | Description |
---|---|---|
depends_on_field |
Here you can enter the property_name of the field that this field should become dependent on. | |
depends_on_operator |
Determine the operator to use to check the value of the field against | |
depends_on_value |
Determine which value must be present, or not present | |
depends_on_action |
Here you can determine what to do with the field. By default, the action toggle-visibility is used. |
There are a lot of different type of field available in Wiser, each for different purposes. Here is the list of field types and the options they all have. Some of them have even more options that are not described here because they are based on KendoUI components. See the documentation of KendoUI for all the options.
The action button field type allows you to add buttons that perform 1 or more actions in sequence when clicked. The actions are executed in the order they are set. These buttons can be added to the Wiser item itself (for example to make a printout of the item's data) but they can also be added to 'Grids' and there they are often the most powerful, because you can then perform actions on multiple lines at once. These grids can be used in Wiser as a field type in an item (for example, to show a list of subaccounts within an account), but the action buttons can also be used as buttons in a GridView module. This is the type of module in Wiser that displays data using a table (see the documentation on modules for more information).
This is a list of the available actions that can be set. Documentation on how to set each action specifically can be found here.
-
openUrl
: opens a URL in a new window -
executeQuery
: execute a query on the database -
openWindow
: opens a specific item from Wiser -
generateFile
: generate an HTML file or a PDF of this HTML file -
generateTextFile
: generate a text file -
updateItemLink
: update a link between 2 items -
refreshCurrentItem
: refresh the active opened item -
refreshAllOpenedWindows
: refreshes all windows opened in Wiser -
apiCall
: calls an API -
pusher
: send a message to another Wiser user via Pusher -
custom
: perform specific scripting -
actionConfirmDialog
: opens a confirmation dialog
The above actions also have some specific settings that are described here TODO LINK.
Also, before an action is executed you can ask for input from the user in advance. For this purpose the UserParameter object is available which can be set per action. Thus, with this extended field type ActionButton you create a lot of interaction between user and the Wiser system with different types of outcomes.
You can set the following properties for the button in the options
column:
Property | Mandatory | Default value | Explanation |
---|---|---|---|
text |
no | 'Actie uitvoeren' | The text displayed on the button. |
icon |
no | gear | The icon shown to the left of the text on the button. You can use one of these icons here: Kendo Icons. Below each icon on that page is a class name, such as .k-i-sln , remove the .k-i- part from that, what remains can be entered into this property. In the example above, that would be sln . |
doesCreate |
no | false | Set this value to true when this button creates an item. This is required for permissions, if the user does not have permissions to create items and this option is set to true, the button will be disabled. |
doesUpdate |
no | false | Works the same as doesCreate , but for updating |
doesDelete |
no | false | Works the same as doesCreate , but for deleting |
disableSuccessMessages |
no | false | Set to true to ensure that the "Alle acties zijn uitgevoerd" message is not displayed after successfully performing the action(s). |
actions |
yes | Fill in the array with 1 or more 'actions'. An action is also described via a JSON object where you can set what exactly it should do. The actions are executed in the order they appear in this array. Read more information about setting the actions here. |
If the button is attached to a grid, the following additional options are available:
Property | Mandatory | Default value | Explanation |
---|---|---|---|
allowNoSelection |
no | false | By default it is mandatory for the user to select a line in the grid, if this setting is set to true it is no longer mandatory and the button is always visible. |
minSelectedRows |
no | 1 | With this, you can configure that the user must select at least X lines in the grid to use the button. |
maxSelectedRows |
no | 0 | Allows you to set that the user must select a maximum of X lines to use the button. Set the value to 0 if there is no limit. |
style |
no | This allows you to add custom CSS to the button. | |
groupName |
no | This makes it possible to group different buttons. The user will then see a dropdown with the name of this group and it will show all the options with this group name set. |
The individual actions in a group do not get icons. The group itself gets the icon of the first action in that group. |
When an action button is deployed in a GridView module, the following additional properties are available:
Property | Mandatory | Default value | Explanation |
---|---|---|---|
rebuildMainGridAfterActions |
no | false | If this value is set to true , the entire grid is rebuilt after performing the action(s). This is useful if, for example, the values in the grid have changed after performing the actions. |
With the 'chart' field type, it is possible within Wiser to display charts in various forms supported by the Kendo UI Charts functionality. Complementing this, of course, is the ability to have these charts populated with data from database managed by Wiser.
The most important property to be entered in the options field is queryId, which is the query from the table wiser_query
used to retrieve the data.
In addition, all properties from the Kendo Charts documentation can be used to display this data.
Example of a funnel representation:
{
"queryId": 1,
"title": { "text": "Leads funnel" },
"legend": { "visible": false },
"series": [
{
"type": "funnel",
"labels": {
"visible": true,
"background": "transparent",
"template": "#= category #: #= value#"
},
"colorField": "color",
"dynamicSlope": false,
"dynamicHeight": true,
"field": "numberofleads",
"categoryField": "fase"
}
],
"dataSource": {
"sort": {
"field": "fase",
"dir": "asc"
}
}
}
Example of a pie-chart representation:
{
"queryId": 1,
"series": [
{
"type": "pie",
"field": "amount",
"categoryField": "name"
}
],
"tooltip": {
"visible": true,
"format": "c",
"template": "#= category # - #= kendo.toString(value, 'n0') #"
},
"dataSource": {
"sort": {
"field": "name",
"dir": "asc"
},
"schema": {
"model": {
"fields": {
"name": {
"type": "string"
},
"amount": {
"type": "number"
}
}
}
}
}
}
Example of a bar-chart representation:
{
"queryId": 79,
"title": { "text": "Number of leads per month" },
"legend": { "visible": false },
"seriesDefaults": {
"type": "column",
"labels": {
"visible": false,
"background": "transparent",
"template": "#= dataItem.employeename #: #= value#"
}
},
"tooltip": {
"visible": true,
"template": "#= dataItem.employeename #: #= value#"
},
"series": [
{
"field": "numberofleads",
"categoryField": "month",
"stack": "lead",
"colorField": "leadscolor",
"name": "#= group.value #"
},
{
"field": "numberofprospects",
"categoryField": "month",
"stack": "prospect",
"colorField": "prospectscolor",
"name": "#= group.value #"
},
{
"field": "numberdealsclosed",
"categoryField": "month",
"stack": "closed",
"colorField": "closedcolor",
"name": "#= group.value #"
}
],
"dataSource": {
"group": {
"field": "employeename"
}
}
}
This type of field involves a yes/no or on/off value. If you don't set anything, it just becomes a "normal" checkbox.
The field can also be set as a switch with an image. To set this you need to set the mode
option to switch
and you can add an imageId
to load an image from the wiser_itemfile
table, or an imageUrl
to load an external image.
Examples:
{
"mode": "switch",
"imageId": 115
}
{
"mode": "switch",
"imageUrl": "https://yoururl.com/image.png"
}
This field results in the "default" color picker from Kendo. We have not added any additional functionality to this except of course that the data is saved and loaded from the Wiser database. You can read here what you can additionally set up and here are some demos.
This is a dropdown into which the user can also type (and thus search or filter). A combobox can be set up in different ways.
There are 2 properties of the combobox that can always be set, namely:
useDropDownList
. When this property is set to true
, a kendoDropDownList
is used and otherwise a kendoComboBox
is used. In the latter, a value can be entered to search the list of options or to enter a new value or to leave it empty. As a consequence, the list can only be opened by clicking the arrow. With a kendoDropDownList
, the entire field can be clicked to open the list of choices and then a separate search field is displayed to filter within the choices. Only one can be selected from the available options.
The second option that is always available is optionLabel. This allows you to replace the default placeholder with another text. For more information, see Kendo's documentation.
The other settings of this component depend on how the list of choices should be constructed. There are several options here (such as filling from a query or a fixed predefined list and more).
(Note: _If you expand these options, also check if you need to change anything in the import module, which also uses these settings, for importing values from ComboBoxes).
This type of field displays a button that opens the Wiser 'data selector module' in a popup via an iframe. If an ID of a data selector is already stored in this field, that data selector is opened and otherwise a new, empty, data selector is displayed. When saving the data selector, its ID is stored in a hidden field located above the button. When the user saves the item itself, that ID is also stored in wiser_itemdetail
.
The default text of the button is "Bewerken", but the text can be modified in this way:
{ "text": "Open data selector" }
This type of field can be used to select a date and/or time. You can set whether it should be a date + time field (this is the default), a time-only field or a date-only field. You can do this by filling in a JSON object in the options
with the property type
. You can then enter date
or time
as the value there.
If you want to set that the default value of the field should always be the current date and/or time, you can do so by adding this to options: "value": "NOW()"
.
The date is always stored within Wiser in the format YYYY-MM-DD and the time in the format HH:MM:SS.
Example settings for a date time picker:
{
"type": "date",
"value": "NOW()"
}
You can also enter a minimum date and/or time. For example for a time picker you can do this:
{
"type": "time",
"min": "14:00"
}
This type of field is intended to add "empty" blocks to the screen, for example, so that blocks can be better aligned or space can be made between two fields. Useful for padding a line, for example.
By setting the default_value
, fixed HTML can be shown in the empty block. So you can also show static information in such a field. Or use custom scripting to make this information dynamic.
When creating an Empty type, it is important to fill in the 'Eigenschap naam' property_name
with, for example, 'filler' to clarify what the field is used for. 'filler' is used when the field's purpose is to improve visualising the other fields.
A query can also be set up through the data_query
column or by adding a queryId
to the options
. In this query, {itemId}
can be used to do something with the currently opened item. The results of this query can then be set as a variables in default_value
.
This is a component that allows adding files to the wiser_itemfile
table. This is a Telerik Kendo UI component, you can view its documentation here.
By default, users can upload multiple files. If you want them to be able to upload only 1 file (per field), set the multiple
option to false
.
By default, it is only possible to upload files, but there is also a setting to indicate that users can add a URL to a file. To use that, enter the "showAddFileUrlButton": true
option.
Also by default, files uploaded via this field are marked as protected
, which means that they can only be opened/downloaded via a temporary encrypted ID, to prevent users from downloading files by trying out random IDs. To disable this feature, set the option filesCanBeAccessedPublicly
to true
. This is not important in Wiser itself, because files can never be downloaded without authentication there, but it is important for any publicly accessible websites that use the GCL and run on the same database. The GCL has endpoints/URLs for download files from wiser_itemfile
tables, if the column protected
is not set to 1
, then anyone can download any file that they know (or guess) the ID of. So make sure you only use this option when you know for sure that files that will be uploaded here do not contain sensitive data. It's also recommended to add a description to this field that warns people that upload files here to never upload files with sensitive information there.
Files are stored in the database by default. It is also possible to store them physically on server(s) by uploading them via FTP. The FTP data can be set via the master data module, create a folder there and add an entry of type ftp_configuration
in that folder for each client server. If the particular Wiser setup does not already have this type, add it to wiser_entity
and wiser_entityproperty
. Then for each field, where files should not be added to the database, add the option "useFtp" : true
. You can also set a subfolder where the images should be placed, using this option: "uploadDirectory" : "folder/subfolder"
.
You can also add validation if you want users to be able to upload only files with certain extensions by setting the validation property as in the full example below:
{
"validation": {
"allowedExtensions": [".jpg", ".jpeg", ".png", ".bmp", ".gif"]
},
"showAddFileUrlButton" : true,
"multiple": false,
"useFtp": true,
"uploadDirectory": "folder/subfolder"
}
It is also possible with this component to retrieve files by query and display them. For example to display a list of documents linked to the opened item. To do this, fill in the property queryId
with a query from the table wiser_query
. If this option is used, it is no longer possible to upload files. This query should contain the same columns as in the example below:
SELECT
id AS fileId,
item_id AS itemId,
file_name AS name,
title,
added_on,
IFNULL(OCTET_LENGTH(content), 0) AS size,
extension
FROM `wiser_itemfile`
WHERE item_id = {itemId}
The Grid in Wiser can be used in several ways:
- As a grid containing all linked items to the opened item (via
wiser_itemlink
). Within Wiser this is also referred to as 'sub-entities'. - As a grid with data from a custom query
- As a grid with non-predefined properties of a particular item. These properties must fall into a certain 'group'.
It is possible to select rows in a grid and then use 'action buttons' to perform actions with the information from the selected rows. It is also possible to edit data in a grid. This requires some setup. This chapter contains all the information about setting up a grid.
Items that are linked to the opened item via a specific type number can easily be displayed in an overview using this grid. Also, these items can be edited via this grid and new items/links can be added if necessary.
You can set the following things in the options column:
Column | Default value | Explanation |
---|---|---|
entityType |
The entity type of items to be displayed. | |
pageSize |
10 | The number of rows to display per page. |
customQuery |
false | Set to true if you want to retrieve data with a custom written query. Enter this query in the column data_query of the table wiser_entityproperty . More information about this custom query and how to setup can be found further down this chapter. |
hideIdColumn |
false | Set to true or 1 if you want the column Id not to be shown in the grid. |
hideLinkIdColumn |
false | Set to true or 1 if you want the column LinkId not to be shown in the grid. |
hideTypeColumn |
false | Set to true or 1 if you want the column Type not to be shown in the grid. |
hideEnvironmentColumn |
false | Set to true or 1 if you want the column Environment not to be shown in the grid. |
hideTitleColumn |
false | Set to true or 1 if you want the column Title not to be shown in the grid. |
hideTitleFieldInWindow |
false | Set to true or 1 to hide the title field when opening an item from this grid.This option is only used if the option showTitleFieldInWindows is enabled for the module (in the module settings). |
hideCommandColumn |
false | Set to true or 1 if you don't want to show the button to open the item. |
deletionOfItems |
off | You can enter one of the following values here: off: It is not possible to delete items. deleteLink: The delete button only deletes the link between the 2 items. deleteItem: The delete button always deletes the link and the item itself. askUser: When deleting, Wiser asks the user whether only the link should be deleted, or also the item itself. |
showDeleteConformations |
true | With this option you can set whether a confirmation should always be asked for when deleting lines in this grid. |
linkTypeNumber |
2 | You can enter a number here which determines which links should be shown or created. You can use one of the values below, or enter your own value (above 100): 1: This is a main link. For a product, for example, enter 1 for the link to the main category of that product. 2 - 100: These are not used yet, but are reserved for possible new standard links in the future. 100-4999: Freely available for your own custom links. 5000+ links reserved (and defined) by Wiser and the GCL (for example, Basket and BasketLine |
selectable |
false | If the user should be able to select rows or cells in the grid (for certain actions in the toolbar, for example), you can specify that here. Possible values are: row: The user can select 1 row. multiple, row: The user can select 1 or more rows. cell: User can select 1 cell in the grid. multiple, cell: User can select 1 or more cells in the grid. |
persistSelection |
false | Indicated whether the selection will be persisted when sorting, paging, filtering and similar actions are performed. Using this options requires an id to be defined in the data model. |
checkboxes |
false | When set to true , an extra column is added to the left of the grid with checkboxes, allowing the user to select rows using those checkboxes. |
disableOpeningOfItems |
false | Set to true or 1 if it should not be possible to open items in the grid (by double-clicking and/or the button to the far right of each item). |
disableInlineEditing |
false | Set to true or 1 if you do not want the user to be allowed to change values in the grid. |
hasCustomInsertQuery |
false | Set to true or 1 if you are using the grid with a custom data_query and have also entered a custom grid_insert_query . This will also create a button in the toolbar of the grid to add a new item, using the grid_insert_query . |
hasCustomUpdateQuery |
false | Set to true or 1 if you are using the grid with a custom data_query and have also entered a custom grid_update_query . This allows items in the grid to be updated (inline), which then uses that grid_update_query. In this query, you work with parameters corresponding to the names of the columns. For example, for this example: UPDATE wiser_item detail SET color=?colorColumnName WHERE id={itemId}
|
hasCustomDeleteQuery |
false | Set to true or 1 if you are using the grid with a custom data_query and have also entered a custom grid_delete_query . This allows items in the grid to be deleted, which then uses that grid_delete_query . |
showAddedOnColumn |
false | Enter true or 1 if you want to show the column Added by in the grid. |
showAddedByColumn |
false | Enter true or 1 if you want to show the column Added on in the grid. |
showChangedOnColumn |
false | Enter true or 1 if you want to show the column Modified by in the grid. |
showChangedByColumn |
false | Fill in true or 1 if you want to show the column Changed by in the grid. |
refreshGridAfterInlineEdit |
false | With this option you can ensure that all data in the grid is reloaded after someone makes a change in the grid (inline). Enter true or 1 to turn this on. |
dataSelectorId |
If the grid is to retrieve data from a data selector (via get_items.jcl), enter the ID of the relevant data selector here. | |
fieldGroupName |
Enter a value here if you need a grid that allows editing item_details of a particular group. The grid will then show everything from wiser_itemdetail of the opened item, with the entered group name. | |
languageCode |
This is used in combination with fieldGroupName . This allows you to set a default language for all lines in this grid. Then only rules with this language are shown and when creating new rules, that language is automatically filled in. |
|
searchGridSettings |
This is an object that allows you to adjust settings for the grid of items linking. This object is the same as the settings of a module in wiser_modules , including the fieldMappings . For more information, therefore, see the section "Setting Filters Properly" in Additional Settings in modules. |
|
searchGridSettings.enableSelectAllServerSide |
false | By default, the checkbox to select all works only client-side, that is, on everything you can currently see. If it is desired to select everything server-side, this option can be set to true .Note that selecting everything can then take a long time if there are many results. |
currentItemIsSourceId |
false | By default, a sub-entities grid shows items associated with the opened item. If this option is set to true , this is reversed, showing all items that the opened item is linked to.This then also works for the "link item" button, it then also works the other way around. |
columnMenu |
false | Set this option to true to allow users to choose which columns they want to see and which they do not. This is then stored in wiser_itemdetail with the logged in user's item_id , groupname is always grid_settings and the key is a unique value for that grid. |
keepFiltersState |
true | By default, any filters set by the user are remembered and stored with their account. If the user then later reloads the module, the saved filters will be loaded. This functionality can be turned off by setting this option to false . |
allowOpeningOfItemsInNewTab |
false | This adds another button at the end of each line. This button allows items to be opened in a new tab in Wiser (as if you were opening a new module). This does not work when the disableOpeningOfItems option is set to true . |
columns |
An array of column objects to set which columns should be displayed if a custom query is used. If this property is not specified, all columns of the query will be shown except those with the suffix _hide in their names. |
Furthermore, all other settings from Kendo Grid can be used here, except for things that are not valid JSON properties, such as event bindings and the like.
If you want to use a custom query to populate a grid, you can enter that query in the data_query
column of wiser_entityproperty
. If you use this, among others, the hideLinkIdColumn
, hideTypeColumn
, hideEnvironmentColumn
and hideTitleColumn
options are ignored, because you use a custom query to determine which columns to display.
You can also open items from a grid by double-clicking on a cell, of course there can be links to different items in 1 row. Consider this example:
Invoice number | Customer | Contact | Amount |
---|---|---|---|
AA_001 | Microsoft | Bill Gates | € 10,00 |
AA_002 | SpaceX | Elon Musk | € 50,00 |
In this example, you want to be able to open both the customer (if you double-click on the customer name) and the invoice if you click on an invoice number, etc. When writing the query, then, for each item you want to be able to open, the name of each column in that query should end with an underscore (_) followed by the name of the entity type (for example, invoice). You also need to make sure that you retrieve the ID column of each entity type (both readable and encrypted). If the user then double-clicks on a cell, it will open the correct item based on that. In the case of double-clicking in the 'amount' column, we also want the invoice itself to be opened, for that purpose a column entitytype
is added so that the grid knows what the 'default' entity is that may be opened.
An example query for the above table could be:
SELECT
invoices.id AS id_invoice,
invoices.id.id AS encrypted_id_encrypt_withdate_invoice,
invoices.number AS number_invoice,
'invoice' AS entity_type #this is the default entity which will be opened
customer.id AS id_customer_hide,
customer.id.id AS encrypted_id_encrypt_withdate_customer,
customer.name AS name_customer,
contacts.id AS id_contact,
contacts.id.id AS encrypted_id_encrypt_withdate_contact,
contacts.fullname AS fullname_contact
FROM invoices.... etc.
If you want to display data from a non-Wiser/custom table, you don't have to take this into account, and you can name the columns as you like.
If you want to have a column in the dataset but not show it in the grid, you can add the suffix _hide
to that column. The full column name will then become 'id_invoice_hide', for example. Of course, you can also set all the column names for the grid manually and thus determine which columns are visible or not.
Items in a grid can also be opened by double-clicking on the row (if no specific ID is known for the cell) or by using the 'open' button in the rightmost column. To do this, however, there must be a column called encrypted_id
and entity_type
in the query results. If it is not there, the functionality to open items will not work and the button for it will not be visible. This functionality can also be disabled by setting the disableOpeningOfItems
option to true
.
Note: If you want to enable the functionality to remove links between items, then your query must also contain the column link_type_number
(without suffix or prefix, because this is always about the main link). By default, this does assume that the opened item is the destination. Sometimes in a grid you want to show things the other way around, that for example you show all categories to which a product is linked. In that case removing a link will not work by default. To solve that, make sure that the grid's query contains a column named encrypted_destination_item_id_encrypt_withdate
with the item ID of the destination as the value. Also, that query should contain the column encrypted_id_encrypt_withdate
, which should be the ID of the source.
It is possible to set a grid so that it shows all properties of a particular group from wiser_itemdetail
of the corresponding item. For this the property fieldGroupName
must be set, no other settings are required.
This is useful for cases where dynamic fields are added by imports, for example. If you do not know in advance what kind of fields/properties an item might have, you cannot add rules for it to wiser_entityproperty
. To still make these properties manageable, the grid can be used with this setup.
This is very simple to set up, here is an example:
{
"fieldGroupName": "test"
}
You can completely control how the columns should be displayed in the grid, so that you don't see the entity type at each column, for example. You can do this by specifying an array of columns in the property columns
in the options
column of wiser_entityproperty
. More information about that array of columns can be found on the Kendo website. An example of options JSON with various column settings can be seen here:
{
"entityType": "invoice",
"deletionOfItems": "askUser",
"customQuery": true,
"disableInlineEditing": false,
"columns": [
{
"field": "id_invoice",
"title": "Id",
"width": "50px",
"editable": false
},
{
"field": "number_invoice",
"title": "Invoice number"
},
{
"field": "type_invoice",
"title": "Type of invoice",
"template": "#: type_name #",
"editor": "kendoDropDownList",
"dataQuery": "SELECT id AS value, type_name AS text FROM custom_invoicetypes"
},
{
"field": "invoicedate",
"title": "Invoice date",
"format": "{0:dd-MM-yyyy HH:mm}",
"editor": "dateTimeEditor"
},
{
"field": "code",
"title": "Code",
"values": [
{
"text": "Beverages",
"value": 1
},
{
"text": "Food",
"value": 2
}
]
}
]
}
The grid's toolbar can be set via the Toolbar JSON object within the grid's options JSON with the following settings:
Property | Default value | Explanation |
---|---|---|
toolbar.hideExportButton |
false | Allows you to specify whether the button to export to Excel should be hidden. |
toolbar.hideCreateButton |
false | Allows you to specify whether the button to create a new item should be hidden. |
toolbar.hideLinkButton |
false | Allows you to specify whether the button to link existing items should be hidden. |
toolbar.linkItemsQueryId |
If you want to use a custom query for the grid to link items instead of the default query, you can put the ID of that query (from table wiser_query ) in here. |
|
toolbar.linkItemsCountQueryId |
If you want to use a custom query for the grid to link items instead of the default query, you can put the ID of that query in there. | |
toolbar.customActions |
[] | Allows you to have specific actions done for the selected rows in a grid. These are action-button type buttons, so see the chapter on action buttons to see how to set them up. The value should be an array of action objects. A grid can have multiple buttons where each button can perform 1 or more actions. In addition, you can use the values of the selected items in the grid in actions such as executeQuery. To use those you always need the prefix selected_. For example, if you want to use the ID of the selected items, you can use the variable {selected_id} in your query where id is the column name. With executeQueryOnce all parameters with selected_ contain a comma-separated list of all unique values of the selected items. Values that the user must enter himself (parameters) are requested only once and then reused in all subsequent actions. |
toolbar.hideClearFiltersButton |
false | By default, a button is shown at each grid that allows the user to clear all filters. This button can be hidden by setting this option to true . |
toolbar.hideFullScreenButton |
false | By default, a button is shown with each grid that allows the user to enlarge the grid so that it uses the full screen. This button can be hidden with this option. |
toolbar.hideCount |
false | By default, a text is shown (top right, in the toolbar) with the total number of results. This text can be hidden by setting this option to true . |
toolbar.linkItemsSetOrdering |
false | If you want the 'ordering' to be set when linking or unlinking items. Disadvantage: Runs multiple queries instead of one. |
Sample settings of a grid:
{
"entityType": "address",
"hideLinkIdColumn": true,
"hideTypeColumn": true,
"hideEnvironmentColumn": true,
"hideTitleColumn": true,
"deletionOfItems": "askUser",
"linkTypeNumber": 100,
"selectable": "multiple, row",
"checkboxes": true,
"toolbar": {
"hideExportButton": false,
"hideCreateButton": true,
"hideLinkButton": true,
"customActions": [
{
"text": "Set contact person for address",
"icon": "js",
"actions": [
{
"type": "executeQuery",
"userParameters": [
{
"name": "contactName",
"question": "Fill in a name"
}
]
}
]
}
]
}
}
If you want users to be able to edit items in such a grid, you need to fill the grid_delete_query
, grid_insert_query
and grid_update_query
columns with your own queries to edit data in the grid. In those queries, you can then use all the values from the grid's data_query
as variables. If users are not allowed to edit data in the grid, you can leave all those queries empty, but you must set the disableInlineEditing
option to true
.
In all these queries you can also use the variables {propertyKey0}
and {propertyValue0}
, where the number 0 is then incremented each time for each property/column in the grid. These will then appear in the same order as they appear in the grid. This can be used to create a dynamic query to add everything to wiser_itemdetail
, for example.
Note that we have autoSync
enabled in grids. Then, when the user clicks on "Add Item", Kendo already immediately calls the grid_insert_query
where all columns are set to null
. If you have a table with columns that are NOT NULL
, then you need to make sure that your query includes default values there using the IFNULL
function.
Here is an example of a grid that uses custom queries:
{
"customQuery": true,
"disableOpeningOfItems": true,
"hasCustomInsertQuery": true,
"hasCustomUpdateQuery": true,
"hasCustomDeleteQuery": true,
"columns": [
{ "field": "id", "title": "ID", "width": "50px", "editable": false },
{ "field": "title", "title": "Titel" },
{ "field": "code", "title": "Code" },
{ "field": "item_id", "title": "ItemId" },
{ "field": "datetime", "title": "Datumtijd", "format": "{0:dd-MM-yyyy HH:mm}", "editor": "dateTimeEditor" },
{ "field": "user_id", "title": "GebruikerId" },
{ "field": "username", "title": "Gebruikersnaam" }
]
}
Example of data_query:
SELECT * FROM _test_table
Example of grid_delete_query:
DELETE FROM _test_table WHERE id = ?id
Example of grid_insert_query:
INSERT INTO _test_table (code, datetime, item_id, title, user_id, username)
VALUES (IFNULL(?code, ''), IFNULL(?datetime, NOW()), IFNULL(?item_id, 0), IFNULL(?title, ''), IFNULL(?user_id, 0), IFNULL(?username, ''))
Example of grid_update_query:
UPDATE _test_table SET code = IFNULL(?code, ''), datetime = IFNULL(?datetime, NOW()), item_id = IFNULL(?item_id, 0), title = IFNULL(?title, ''), user_id = IFNULL(?user_id, 0), username = IFNULL(?username, '') WHERE id = ?id
We also created custom column types with additional settings. This section explains more about them.
Dit is een kolom die een balk toont met een voortgang. Om hier gebruik van te maken moet je eerst zorgen dat de data voor deze kolom altijd een getal bevat. Then, for the column, you need to fill the property template with this: <div class='progress'></div>
. Then a default progress bar is created. You can then set some more options here:
Create the property progressBarSettings
, which is an object with the following properties:
- maxProgress: Allows you to set the maximum value of the bar. By default, this is 100.
-
progressColors: This is an array in which you can set colors. Each color has these options:
- max: Only values less than or equal to this value get this color. These are then sorted in descending order. So for example, if you add a color red with max 100 and a color green with max 50, all lines with a value between 51 and 100 will get a red color and everything of 50 or lower will get a green color.
- background: The HTML color for the background.
- border: The HTML color for the border of the bar.
Example of grid settings with a progress bar:
{
"customQuery": true,
"disableOpeningOfItems": true,
"hasCustomInsertQuery": true,
"hasCustomUpdateQuery": true,
"hasCustomDeleteQuery": true,
"columns": [
{
"field": "id",
"title": "ID",
"width": "50px",
"editable": false
},
{
"field": "progress",
"title": "Voortgang",
"template": "<div class='progress'></div>",
"progressBarSettings": {
"maxProgress": 100,
"progressColors": [
{
"max": 10,
"background": "#8EBC00",
"border": "#8EBC00"
},
{
"max": 75,
"background": "#FF952B",
"border": "#FF952B"
},
{
"max": 100,
"background": "#FF0800",
"border": "#FF0800"
}
]
}
}
]
}
This is a field that allows rich content to be managed through a WYSIWYG editor. HTML can also be worked with via the source tab. Like all other fields, you can use all options that Kendo offers by default. As well as the various tools you want to make available in the editor. All of Kendo's standard tools are available here, along with some additional tools offered by Wiser. The tools from Kendo can be entered as a string (with quotes), but the additional (Wiser) tools cannot. So for example, for a standard tool you add this to the array: "bold"
, but for a Wiser tool you enter that without quotes: imageTool
. Here is a list of our own created tools:
Name | Explanation |
---|---|
imageTool |
This tool opens Wiser's default screen that allows you to add images. |
templateTool |
This tool opens the standard Wiser screen that allows you to add HTML templates. This is not the "templates module," but it allows you to add individual HTML templates, which the client can then use to create their content. |
dynamicContentTool |
This tool opens Wiser's default screen that allows you to add dynamic content. |
htmlSourceTool |
This tool opens a new window containing the HTML code of the field. This is loaded into Codemirror, making it finer to work with. |
wiserMaximizeEditor |
This tool makes the HTML editor fullscreen. |
contentBuilderTool |
This tool allows you to open the HTML in a content builder window. This is a different kind of editor that gives you other options and is even more user-friendly for formatting entire pages (via WYSIWYG). |
entityBlockTool |
This tool can be used to add an entity block to the HTML. |
There is also the option mode that allows you to determine default sets of tools. These are the possible options:
Value | Included tools |
---|---|
1 | bold italic underline strikethrough maximizeTool |
2 | As value 1, supplemented by: justifyLeft justifyCenter justifyRight justifyFull insertUnorderedList insertOrderedList indent outdent createLink unlink youTubeTool |
3 | As value 2, supplemented by: tableWizard createTable addRowAbove addRowBelow addColumnLeft addColumnRight deleteRow deleteColumn contentBuilderTool (basic) |
4 | As value 1, supplemented by: contentBuilderTool (notable) htmlSourceTool contentBuilderTool (basic) |
99 | As value 3, supplemented by: imageTool templateTool dynamicContentTool subscript superscript htmlSourceTool formatting cleanFormatting fontName fontSiz foreColor backColor |
By default, an HTML editor is simply displayed inline. It is possible to set it to show only a button. This button then opens a new window in which the html-editor is displayed. To activate this operation, you can set the property buttonMode to true
.
With mode 99 by default there is a small button in the editor for a content builder. By default, this button doesn't really stand out. If you want it to stand out more, you can set the contentBuilderMode
option to notable
, then it will appear at the front of the toolbar with text attached.
Example options
:
{
"mode": 2,
"buttonMode": true,
"allowAbsoluteImageUrls": false,
"contentBuilderMode": "notable"
}
While saving, a number of things are modified in the HTML of an HTML editor so that it will work properly on the website. One of these things is that, if the system object from table (easy_objects) wiser_save_images_relative
is set to true
, the main domain of the website is removed from the URL of all images, so you get relative paths for images. However, you don't always want this, even if you have that option turned on. With an e-mail template, for example, you never want this, because then the images in the e-mail won't work. In such a case, you can turn this off in a specific HTML editor by setting the option allowAbsoluteImageUrls
to true in the options of the field.
This component allows an iframe with a dynamic URL to be placed on an item. A query can be entered in the data_query
column and a URL in the default_value
column. The URL can then contain variables that are then replaced with the results of the query. Any column that is returned from the query can be used in it. If the query returns multiple records, only the first record is used and the rest are ignored.
Note that the website you are trying to load into the iframe here must allow external loading and must also be accessible via SSL (httpS).
Example query:
SELECT 123 AS test1, 'abc' AS test2
Sample URL:
https://www.yourdomain.com/test/?value={test1}&anothervalue={test2}
The final URL loaded into the Iframe is then:
https://www.yourdomain.com/test/?value=123&anothervalue=abc
This is the same kind of component as File-upload
, but with a different template and default validation. Therefore, see also the file-upload
section above for possible additional settings.
With image uploads, the option filesCanBeAccessedPublicly
is set to true
by default, because images usually should be. If this is ever not the case, make sure you set this option to false
on the corresponding image-upload
field. See the File-upload
chapter for more information of what this option does.
Additional image-upload properties for the option field:
Property | Explanation |
---|---|
useTinyPng |
This option can be set to true if all images added in this field should be automatically resized via the API of TinyPng. There are two more settings that you can set for each client in the client settings. These are TinyPngApiKey and TinyPngMaximumCompressionsPerMonth . If these settings are not set at the client, the general API key is used, which is in the API's appsettings.json . The maximum number of compressions per month has a default value of 500, if a client has their own API-Key with a different plan, the correct number of compressions must also be entered, to prevent the API from being used when the limit has been exceeded.TinyPng only works for images with the extensions .png and .jpg, for other extensions TinyPng is not used and the original image is saved. |
useCloudFlare |
Set to true to save the image to Cloudflare image API instead of database |
useAmazonS3 |
Set to true to save the image in an Amazon S3 bucket. If this property is set to true , the property amazonS3BucketName becomes required. |
amazonS3BucketName |
The name of the bucket in Amazon S3. This property is required if useAmazonS3 is set to true . |
This is a default 1-line text field.
It is possible to set this input-box to contain a url. This can be done by setting the value type
to url
in the options
field. An extra button will appear next to the text field which can be clicked to open the entered link. It is also possible to add a prefix
and suffix
. The prefix is something that is added at the front of the URL before opening and suffix is added at the back of the URL upon opening. Example:
{
"type": "url",
"prefix": "https://www.yourwebsite.com/",
"suffix": "?opened-from-wiser=1",
"skipOpenUrlDialog": false
}
By default, when the user opens this URL, a question is asked whether they want to open the link within Wiser (in an iframe in a Kendo Window), or in a new window (new tab in browser). This question can be disabled by setting the skipOpenUrlDialog
option to true
. It is recommended to set this option to true if there are links to internal websites in the field in question, because many websites are protected against loading within an iframe from another domain.
Furthermore, it is also possible to set that the corresponding item is saved as soon as the user presses enter
in the field. To do so, set the saveOnEnter
option to true
.
This is a field showing a tree structure including checkboxes of available items. This allows the user to quickly create links to items in the tree by checking the checkboxes. The selected items are also displayed in a grid.
You can set a number of things in the options column:
Column | Mandatory | Default value | Explanation |
---|---|---|---|
moduleId |
yes | 0 | The ID of the module from which all items are to be loaded. These items are then shown in the tree on the left side of the field. |
linkTypeNumber |
no | 2 | The type number of the link to be established. |
entityTypes |
no | Allows you to specify whether only items of certain types should be shown in the tree of this field. This must always be an array (e.g. ["folder", "relation"], even if you only want to enter 1 type. If you enter only 1 type, all items of that type will be shown in a flat list. You will not see the structure of the items. Unless you set the option showStructure to true. If you enter no type or more than 1 type, the structure is always shown. Please note that you can miss items if you do not enter this correctly. For example, if you enter "folder" and "relation", but you have relations hanging under an item of another type (for example "company"), then the relations hanging under a company will not be shown in the tree, because you did not enter the type "company". |
|
showStructure |
no | false | Applies only when entityTypes contains only 1 value. By default, a flat list of all items of this type is then shown, but if this option is set to true, the structure is shown with subfolders. |
hideCommandColumn |
no | false | Enter true or 1 here if you want the column with the button to open the item in a pop-up not to be shown in the grid. |
disableInlineEditing |
no | false | Enter true or 1 here if you do not want the user to be allowed to change values in the grid. |
disableOpeningOfItems |
no | false | Enter true or 1 here if it should not be possible to open items in the grid (by double-clicking and the button to the far right of each item). |
deletionOfItems |
no | off | You can enter one of the following values here: off: It is not possible to delete items. deleteLink: The delete button only deletes the link between the 2 items. deleteItem: The delete button always removes the link and the item itself. askUser: The delete button asks the user whether only the link should be deleted or also the item itself. |
orderBy |
no | Allows you to determine how the items in the tree/treeview should be sorted. By default they are sorted by column order. You can enter title here if the items should be sorted by name. | |
toolbar.hideExportButton |
no | false | Allows you to specify whether the button to export to Excel should be hidden. |
toolbar.hideCheckAllButton |
no | false | Allows you to specify whether the button to select all from the tree/treeview should be hidden. |
toolbar.hideUncheckAllButton |
no | false | Allows you to specify whether the button to deselect all from the tree/treeview should be hidden. |
Example of settings for an item linker:
{
"moduleId": 600,
"linkTypeNumber": 101,
"entityTypes": ["relatie"]
}
This field allows you to display an information of items to which the opened item is linked. This information is not directly editable, but which clickable. When you click on it, a new window opens with the linked item.
You can set the following things here in options:
Column | Mandatory | Default value | Explanation |
---|---|---|---|
entityType |
no | item | The entity-type name of the linked items to be displayed in this field. |
linkType |
no | 1 | The type number of the link. This is the value from the type column of the table wiser_itemlink . |
template |
no | {itemTitle} | This allows you to define how the items should be displayed. Here you can insert hard texts and/or variables. You can use all values of the linked item as variables and the following fixed variables: {itemTitle}: The title/name of the linked item. {id}: The ID of the linked item. {environment}: The published environment of the linked item (invisible, dev, test, acceptance or live). {entityType}: The entity type of the linked item. |
textOnly |
no | false | Set this value to true if the items should not be clickable. |
reversed |
no | false | Reads the linked items the other way around from wiser_itemlink . Normally it retrieves the items on the destination_item_id side of the link. This option reverses this to the item_id side of the link. |
noLinkText |
no | 'Geen koppeling' | If the opened item has no link, then this text is displayed in the field. Has no effect if hideFieldIfNoLink is set to true . |
hideFieldIfNoLink |
no | false | Set to true to hide the field when it has no link. |
removeUnknownVariables |
no | false | Set to true to remove variables that have not been replaced. |
Example of settings for linked item:
{
"entityType": "relatie",
"linkType": 2,
"template": "{itemTitle} - {city}"
}
This type of field basically works exactly the same as the Combobox, with the difference that here the user can make more than 1 choice.
A multiselect can also be used in another form, namely as a group of checkboxes. For this, there is an option called mode
(which you can set in the options
column) that you can give the value checkBoxGroup
.
<TODO: image here>
The image in the top (header) bar can be set using the options mainImageId
or mainImageUrl
. With mainImageId
an ID from wiser_itemfile
can be entered and with mainImageUrl
a fixed (external) image can be entered.
The different options shown can come from different sources. This works the same as for a single-select combobox field, see that documentation of the Combobox for more information.
For the multiselect there an extension, namely to indicate which image should be shown for each checkbox. This can be done in several ways:
-
It may be a URL. The dataSource must then contain a property
imageUrl
containing the URL to the image. This must be a full URL. -
It may be a specific image from
wiser_itemfile
. The dataSource must then contain a propertyimageId
containing the ID fromwiser_itemfile
. -
It may be an image associated with an item. The dataSource must then contain a property
id
(which was required anyway for the component) containing the ID fromwiser_item
. Then there must also exist a propertyimagePropertyName
containing the value from theproperty_name
column of thewiser_itemfile
table of the desired image. This property can be set in the dataSource per item, or globally in theoptions
-value of the field.
Example settings:
{
"entityType": "PaymentMethod",
"searchEverywhere": true,
"mode": "checkBoxGroup",
"mainImageUrl": "https://yourwebsite.com/image.png",
"imagePropertyName": "icon"
}
This is a field where you can enter a number/number. This can also be used for prices, percentages or other numeric formats. Examples can be found in the Kendo documentation.
Property | Mandatory | Default value | Explanation |
---|---|---|---|
culture |
no | nl-NL | This allows you to specify which country the format should be set for. This causes you to see for example a comma for decimals, or a period, depending on the country set. Currently you can only use en-US and nl-NL. For other countries, additional javascript needs to be loaded into Wiser. |
decimals |
no | Specify how many decimal places the entered value may contain. | |
round |
no | true | Specify whether entered values should be rounded (true) or truncated (false) when a limit of number of decimal places is set. |
factor |
no | 1 | The factor by which the entered value should be multiplied. This can be useful if you want to store a different value in the database than the one shown to the user. For example, if the database stores 15 and the value of factor is set to 100 then the user will see 1500 in the field. |
format |
no | n | The format to use to display the value to the user. You can find more information about it here: [Number Formatting |
max |
no | The highest value the user is allowed to enter. | |
min |
no | The lowest value the user is allowed to enter. | |
step |
no | 1 | How much to add or subtract to the current value when the user uses the arrows to increase or decrease the value. |
saveOnEnter |
no | false | It is also possible to set that the opened item is saved as soon as the user presses enter in the this field. To do so, set the saveOnEnter option to true |
Some examples:
Price/Currency: { "decimals": 2, "format": "c" }
shows € 12,50
Percentage: { "decimals": 0, "format": "# \\%" }
shows 10%
Weight in kg: { "decimals": 2, "format": "#.00 kg" }
shows 50,12 kg
This type of field can be used for values that need to be stored securely. For example, you can use this for storing passwords. Here you can choose whether the value should be stored as hash or encrypted.
You can set the following things in options:
Property | Mandatory | Default value | Explanation |
---|---|---|---|
type |
No | text | Allows you to change the type of the HTML input element. For password fields you can enter password here, for example. |
securityMethod |
No | GCL_SHA512 | Use this option to define how the value should be stored. The following options are available: GCL_SHA512: Store the value as a hash with salt. This then uses the StringExtensions.ToSha512ForPasswords() functionality in the GCL. This automatically adds a random salt to the same hash, eliminating the need for an extra column in the database. GCL_AES: To encrypt the value with AES. This uses the StringExtensions.EncryptWithAesWithSalt() function of the GCL. If you use this, you can also provide a passphrase / encryption key in the SecurityKey property. AES: To encrypt the value with AES. This option works much the same as GCL_AES, except that with this function the result is always the same because no random salt is used. This uses the StringExtensions.EncryptWithAes() function from the GCL. |
securityKey |
No | This option is used only for encryption methods, not for hashes. It is empty by default. The functions "GCL_AES" and "AES" use a default key (which is configurable by application) which is used when you leave this value empty here. |
This field type allows you to display a calendar/scheduler with appointments. To display the correct data in there, you must enter a queryId
in the options
, of a query that is in the table wiser_query
. This query should then return the following columns:
Column | Mandatory | Explanation |
---|---|---|
id |
no | The ID of the appointment, is not used further, so is not required. Note: This is automatically put in the taskId field. |
title |
yes | The title of the appointment |
start |
yes | The start date + time of the appointment. This should be returned in the following format: 2024-06-15T14:00:00+01:00. If it is a datetime column in MySQL, this will work itself out. |
end |
yes | The end date + time of the appointment. |
all_day |
no | To indicate whether the appointment is for the entire day (1) or not (0). |
resources |
no | A comma-separated list of IDs of resources. |
A calendar can also have resources, which are for example meeting rooms, people or cars, so it can be anything. An appointment can have multiple resources associated with it. To retrieve resources dynamically, you can use the resourcesQueryId
option, which should contain the ID of the query in wiser_query
. This query should return the following columns:
Column | Mandatory | Explanation |
---|---|---|
value |
yes | The value to associate the appointments with, usually an ID. These values should then be retrievable in the resources column of the appointment data. |
text |
yes | The name of the resource. For example, 'Speaking Room X'. |
Furthermore, you can also use all the settings described in Kendo's documentation.
This is a standard text field that can contain multiple lines. You can specify the type of text here. If you set nothing, it will be a default text field, if you set something, CodeMirror will be used. You can set this in the property type
and you can set one of the following options:
- css
- javascript
- mysql
- xml
- html
- json
Example option field:
{
"type": "mysql"
}
Getting your data from your own table; You can do this by entering your own query in the column data_query
. The only requirement for this query is that it must contain two columns: id
and name
. The id
column should contain the value to be stored in the database and the name
should contain the value the user sees in Wiser. The id and name may contain the same value.
Examples:
SELECT id, name FROM easy_items ORDER BY name DESC;
You can use the ID of the opened item in this query, by using the variable {itemId}
in the query.
SELECT id, name FROM available_colors WHERE productId={itemId};
It is possible to use additional data from this query to populate other fields of the item (on which this combo box is located) when someone selects a value in the combo box. To accomplish this, you must retrieve additional information in the query and use the property linkedFields
in the options
. That property should then contain an array of all fields linked in this way. The query must then contain columns with exactly the same names and the item must then, of course, also contain fields with those names.
With the property overwriteExistingValues
you can indicate whether the values of the query of the dropdown should be taken over even if the fields on the item are already filled. This defaults to false
, which means that only fields with no value are automatically filled.
An example query and JSON of this is then this:
SELECT
i.id,
i.title AS name,
id1.`value` AS Address,
id2.`value` AS Zipcode,
'US' AS Country
FROM wiser_item i
LEFT JOIN wiser_itemdetail id1 ON id1.item_id = i.id AND id1.key = 'Address'
LEFT JOIN wiser_itemdetail id2 ON id2.item_id = i.id AND id2.key = 'zipcode'
WHERE i.entity_type = 'customer'
AND i.removed = 0
ORDER BY i.title ASC
{
"linkedFields": ["Address", "Zipcode", "Country"],
"overwriteExistingValues": true
}
Furthermore, you can also use the ID of the opened item in the query, by using the variable {itemId}
in the query.
The 2nd option to populate the data in the combo box is to display a list of all items of a particular entity type. You can do this by populating a JSON object in the options column with the following properties:
Property | Mandatory | Explanation |
---|---|---|
entityType |
no | The name of the entity type whose items you want to show all. |
searchInTitle |
no | This defaults to true, set to false to indicate that item titles should not be searched when someone types a value in the dropdown. |
searchEverywhere |
no | This defaults to false. This means that only items are shown that are linked (via wiser_itemlink ) to the opened item. Set to true if you want to show all items of that entity type. |
searchFields |
no | Allows you to specify an array of strings. These are the names of the fields to be searched in when someone searches the combo box. |
minLength |
no | This is the minimum number of characters someone must enter before searching for results. By default, this is set to 0, which means that the search is done immediately without entering anything, giving the user all the options right away. If you enter a value higher than 0 here, then a search is not performed until someone enters something. So this also means that there are initially no choices in the combo box. |
Example:
{
"entityType": "customer",
"searchInTitle": false,
"searchFields": ["firstname", "lastname"],
"searchEverywhere": true
}
The third option is to populate the list with fixed values by overwriting the dropdown's dataSource in the options
column. Example:
{
"dataSource": [
{ "name": "Male", "id": "1" },
{ "name": "Female", "id": "2" },
{ "name": "X", "id": "3" }
]
}
You can also show a list of all users who can log in to Wiser, for the given client. You can show all users (by leaving out or empty userTypes) or only users of one or more types (by entering an array of values in userTypes). You can also select the logged-in user automatically, by filling the property value with "{userId}". Example:
{
"dataSource": "wiserUsers",
"value":"{userId}",
"userTypes": [ "administrators"]
}
You can set the property "dataSelectorId". In it, you then enter an ID of a Data Selector from wiser_data_selector. That data selector is then executed and the combobox is filled with the result. With dataTextField you can set which property contains the text value to be shown in the combobox. Example:
{
"dataSelectorId": 7,
"dataTextField": "lastname"
}
For combo-boxes and multiselects, you can set that the selected values should be stored as a link in the wiser_itemlink
table instead of a value in the wiser_item
detail table (which is default). To do this, you need the settings below, which work for all of the above options, as long as from them comes an ID that exists in the wiser_item table.
Property | Explanation |
---|---|
saveValueAsItemLink |
Set this option to true to enable this functionality. |
linkTypeNumber |
This is the type number used in wiser_itemlink . |
currentItemIsDestinationId |
By default, the opened item is linked to the value(s) chosen in the combo box. If this value is set to true, the entered values are linked to the opened item. |
Note! Always make sure that you define unique values for linkTypeNumber
that are not already used by other fields!
It is also possible to set up that users can create new items at a combobox field. If this is set, an extra button will be visible to the right of the combobox, which will open a screen to create a new item. After saving, the combobox will automatically refresh and the new item can be selected immediately.
To set this up, the subobject newItems
must be added to the options. That object will then have the following properties:
Property | Mandatory | Explanation |
---|---|---|
allow |
no | Set this value to true to enable this functionality. Default is false. |
entityType |
no | The entity type for new items created via this option. If not filled, the entityType of the combo box is used, if it is filled. One of the 2 must always be filled, otherwise the button will not be visible. |
parentId |
no | Enter here the ID of any folder/item to which the new item should be linked. Default is 0. |
linkTypeNumber |
no | The type number of the link between the new item and parentId. Default is 1. |
moduleId |
no | The ID of the module for which the item should be created. This is not required, but if a correct number is not filled here, the item may not be visible anywhere. For master data module items, enter 700. Default is 0. |
Example:
{
"entityType": "branche",
"searchEverywhere": true,
"newItems": {
"allow": true,
"parentId": 14,
"linkTypeNumber": 1,
"entityType": "branche",
"moduleId": 700
}
}
To allow users to open the selected item directly (in a new window), the allowOpeningOfSelectedItem
option can be set to true
. In addition, the query that retrieves the data must also contain the columns encrypted_id
and entity_type
.
This button becomes visible only if a value is also selected in the dropdown.
Allows you to display a timeline of events (date related items).
You can set the following things here in options:
Column | Mandatory | Default value | Explanation |
---|---|---|---|
entityType |
no | The name of the entity type of the items displayed in the timeline. The entity is needed when the items should be able to be opened. | |
queryId |
yes | The id of the query (in the table wiser_query) that retrieves the items to be shown. See below which columns are required. | |
eventHeight |
no | 600 | The height of the event area (the area that opens when you click an item). Because this can contain different content per event, the height is fixed. When the event is longer in terms of content, a scroll bar is automatically shown. |
disableOpeningOfItems |
no | false | When set to "true," items cannot be accessed from the timeline. Selecting an id in the query is then unnecessary, as is specifying an entity type in the options. |
To display data, you must enter a queryId
in the options, of a query that is in the table wiser_query
. This query should then return the following columns:
Column | Mandatory | Explanation |
---|---|---|
encrypted_itemid_encrypt |
no | The ID of the item, is encrypted in the HTML so that it can be used when opening the item. Is only required if the disableOpeningOfItems option is set to false and items can therefore be opened. |
description |
yes | The description of the item, may contain HTML. It is displayed when the item is clicked. |
date |
yes | The date of the item. This should be returned in the following format: 2024-06-27. If it is a datetime column in MySQL, this will work itself out. |
Verder kun je ook alle instellingen gebruiken, zoals die omschreven staan in de documentatie van Kendo.
Sample settings for timeline:
{
"entityType": "offerte",
"queryId": 2,
"eventHeight": 300,
"disableOpeningOfItems": false
}
This allows a QR code to be generated and displayed directly. A query must then be entered in the data_query column with the value of the QR code. This can be a URL or plain text.
Furthermore, the following options are available:
Column | Mandatory | Explanation |
---|---|---|
size |
No | The size in pixels of the image. The image is always square, so this value is used for height and width. Default value is 250. |
For each field, you can execute custom JavaScript that applies only to that specific field. For example, this can be used to adjust the value of field Y based on a change in field X (such as automatically filling in street name after entering zip code and house number).
These custom scripts can be filled in the table wiser_entityproperty in the column custom_script. The script you then enter here is always placed below the default script for that type of field. In the case of fields where data is loaded asynchronously (such as grids and combo-boxes), the custom script is executed only after that data is loaded, so you then also have access to a fully populated field.
In your script, you have access to a number of standard variables. The first variable is field
, which is the HTML element of the field in question and is available in all cases. The second variable is kendoComponent
, this is available only for fields that use kendo. These are almost all fields except input, textbox, checkbox and radiobutton. This variable contains the instance of the corresponding Kendo component and so you can use all functions and properties of that Kendo component (which can be found in the Kendo documentation). The last variable you can use is options
, it contains all the settings you have filled in wiser_entityproperty in the options column and any default settings for that field type. This variable is available for all fields that use Kendo.
Hereby some examples of custom scripts:
Input field that modifies another input field:
field.change(function (event) {
console.log("{title} changed", event);
$("#field_289").val("Hello world" + field.val());
});
A Kendo combo box that adds value to a Kendo HTML editor:
kendoComponent.bind("select", function (event) {
console.log("{title} changed", event);
var id = 0;
var name = "";
if (event.dataItem) {
id = event.dataItem.id;
name = event.dataItem.name;
}
var editor = $("#field_155").data("kendoEditor");
if (!editor) {
return;
}
editor.exec("inserthtml", { value: "Another value was selected: " + id.toString() + " - " + name + "<br>" });
});
An example for looking up address + place based on zip code + house number:
var findAddress = function (changeFieldValues) {
var container = field.closest(".dynamicTabContent");
var otherField = container.find("[data-property-id='386'] .textField");
var zipCode = field.val();
var houseNumber = otherField.val();
var zipCodeFieldContainer = field.closest(".item").removeClass("error");
var houseNumberFieldContainer = otherField.closest(".item").removeClass("error");
if (!zipCode || !houseNumber) {
zipCodeFieldContainer.addClass("error");
houseNumberFieldContainer.addClass("error");
return;
}
$.ajax({
url: dynamicItems.settings.dataUrl + "addressinfo.jcl?trace=false&ombouw=false&zipcode=" + zipCode + "&housenumber=" + houseNumber
}).done(function(result) {
if (!result) {
zipCodeFieldContainer.addClass("error");
houseNumberFieldContainer.addClass("error");
return;
}
if (!result.streetName || !result.placeName) {
zipCodeFieldContainer.addClass("error");
houseNumberFieldContainer.addClass("error");
}
if (!changeFieldValues) {
return;
}
container.find("[data-property-id='55'] .textField").val(result.streetName);
container.find("[data-property-id='66'] .textField").val(result.placeName);
});
};
field.change(function (event) {
findAddress(true);
});
findAddress(false);
Fields can be made interdependent in Wiser. This means that something happens to a field as soon as the value of another field meets certain conditions. These dependencies can be managed in the table wiser_entityproperty
through the following columns:
Here you can enter the property_name
of the field that this field should become dependent on. You can also enter the display_name
if the property_name
is empty.
Here you can determine what to do with the field. By default, the action toggle-visibility
is used. These are the possible actions:
Action | Explanation |
---|---|
toggle-visibility |
This can be set to make this field (in)visible based on values from another field. |
refresh |
Allows you to set this field to refresh when the value of the set field changes. This only works for fields where external data is loaded, such as a combo box or a sub-entities grid. |
This only applies when the toggle-visibility
action is used. Here you must then fill in how to compare. One of the following options can be used here:
Operator | Explanation |
---|---|
eq |
value is equal to |
neq |
value is not equal to |
contains |
value contains |
doesnotcontain |
value does not contain |
startswith |
value starts with |
doesnotstartwith |
value does not start with |
endswith |
value ends with |
doesnotendwith |
value doesn't end with |
isempty |
is empty |
isnotempty |
is not empty |
gte |
value is greater than or equal |
gt |
value is greater than |
lte |
value is less than or equal |
lt |
value is less than |
This only applies when the toggle-visibility
action is used. Here one or more values can be entered (comma separated, without spaces after the commas) with which to compare. The way this works depends on the operator; for example, if the operator is eq
and several values are entered here, this field is only displayed if at least one of those values matches. If the operator is neq
, the field will be shown only if none of the values match. This works the same way for all other operators.