​pixolino PageObject: DataSet (Public BETA)

This PageObject is the frontend connector for pixolino DataSets.

Design and code are handled by a specialized subtemplate. Please refer to the documentation of DataSets and template development in general.

​Demo content

Available parameters:

  • dataset: [string] Unique key of DataDet. Required; if the DataSet does not exist, it will be created. (Use only lower case letters; the key should be unique within the scope of the website.)
  • values: {object}[] Array with key/value objects. A two dimensional object (associative array), where the keys on first level are ordered numbers and the keys on second level are the unique keys of the fields. If the field does not exist, it will are created. See configuration example for details. Optional, no defaults.
  • template: [string] Unique key of subtemplate; required.
  • count: [int] defines how many datasets are shown, values from 1 to 100 are accepted. Optional, default is 12.

Key/value pairs for values object

  • fieldType: [int]
  • required: [bool] Optional, default is true
  • value: [string|int]

The keys “fieldType” and “required” are only required in the first definition of the field.

For the keys use only lower case letters (even though they are referenced as “MY_FIELDn” in the demo code below); the key must be unique within the scope of the dataset.

Available field types

All field types are available; they are identified by the API field type IDs. As demo content does not contain linked files, the use of the field types “Image” and “File” is limited: The value ist sent as string to your template and has to be processed manually there (see example below). If you don't know exactly, how to replicate an existing DataSet image or file, you may use “DEMO” as value. The value “DEMO” will prevent pixolino from rendering the source link to a (not existing) website asset.

Configuration example

{{ fx_page.slot("SLOT_NAME", _context, {"content": [
   {"type": "dataset", "config": {  
      "dataset": "MY_DATASET",
      "values": {
         1: {
             "MY_FIELD1": {"fieldType": 1, "required": 0, "value": "TEST"},
             "MY_FIELD2": {"fieldType": 6, "value": 123}
         2: {
             "MY_FIELD1": {"value": "TEST2"},
             "MY_FIELD2": {"value": 456}
         3: {
             "MY_FIELD1": {"value": "TEST3"},
             "MY_FIELD2": {"value": 789}
      "template": "pxst-dataset-st1",
      "count": 5,
]}) }}

Example: Displaying a demo image (wireframe) within your DataSet template setting

Slot defintion (excerpt):

"YOUR_IMAGE_FIELD": {"fieldType": 9, "value": "DEMO"}

Template code:

{% if dataset.YOUR_IMAGE_FIELD is defined and dataset.YOUR_ALTERNATIVE_TEXT_FIELD is defined %}
    {# The following will only work with "DEMO" as value! #}
    {% if dataset.YOUR_IMAGE_FIELD == "DEMO" %}
        <img src="{{ url("wireframe_image_type", {"width": 100, "height": 100, "type": 1}) }}" alt="{{ dataset.YOUR_ALTERNATIVE_TEXT_FIELD }}"> 
    {% else %}
        <img src="{{ dataset.YOUR_IMAGE_FIELD }}" alt="{{ dataset.YOUR_ALTERNATIVE_TEXT_FIELD }}"> 
    {% endif %}
{% endif %}

Please refer to the documentation of PageObject Image for more information how to use wireframe images in your template.

​For more details how to implement demo content please refer to the Demo Content Documentation.