Skip to content

CardList

CardList widget shows records as file cards in rows. Each card shows a preview of the record file, a title, a description and a status. The user turns the pages, selects a card with a click and opens, edits and deletes files right on the cards.

CardList and CardCarouselList

CardList and CardCarouselList show the same cards and are set up the same way. Both load one page of records at a time: 5 by default, set by the page limit.

  • CardList: any number of records. The page buttons below the cards open the next pages.
  • CardCarouselList: only the records of the first page. The arrows scroll the cards of this page, there is no next page. To show all records, set the page limit to their number, up to 20: the whole page is loaded at once.

Basics

Live Sample · GitHub

How does it look?

cardlist.png

The widget needs one field of type fileUpload. A card shows this file. Without other settings the card title is the file name. In the sample the title and the description come from fields, see Card options.

  • One card is one record of the business component.
  • The cards fill the width of the widget and go on in the next row. The pagination under the cards turns the pages, see Pagination.
  • A click on a card makes it the current record.

How to add?

Example

Step1 Create file .widget.json with type = "CardList". Add a field with type fileUpload and fields for the title and the description. Set them in options.card. see more Fields

{
  "name": "MyExampleCardList",
  "title": "CardList",
  "type": "CardList",
  "bc": "myexample",
  "fields": [
    {
      "title": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      }
    },
    {
      "title": "Custom Field",
      "key": "customField",
      "type": "input"
    },
    {
      "title": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "card": {
      "valueFieldKey": "document",
      "titleFieldKey": "customField",
      "descriptionFieldKey": "customFieldDescription"
    },
    "create": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "edit": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "actionGroups": {
      "include": [
        "create",
        "delete"
      ]
    },
    "fullTextSearch": {
      "enabled": true,
      "placeholder": "Find by title"
    }
  }
}

Step2 Add widget to corresponding *.view.json* .

{
  "name": "myexamplelist",
  "title": "CardList",
  "template": "DashboardView",
  "url": "/screen/myexample/view/myexamplelist",
  "widgets": [
    {
      "widgetName": "SecondLevelMenu",
      "position": 1,
      "gridWidth": 24
    },
    {
      "widgetName": "MyExampleCardList",
      "position": 10,
      "gridWidth": 24
    },
    {
      "widgetName": "MyExampleForm",
      "position": 20,
      "gridWidth": 24
    }
  ],
  "rolesAllowed": [
    "CXBOX_USER"
  ]
}

Main visual parts

Live Sample · GitHub

parts.png

  • preview - the file of the fileUpload field. see Preview
  • status - the value of the first dictionary field, in the middle of the card. see Status
  • title - the file name or a field from titleFieldKey. see Card options
  • description - a field from descriptionFieldKey, under the title. see Card options
  • actions - record actions as icons. They are shown when the mouse is over the card. see Actions
  • pagination - turns the pages of the cards. see Pagination
  • read widget - the file of the selected card, large, above the cards. see Read widget

Title

Live Sample · GitHub

Title Basic

Title for widget (optional)

There are types of:

  • constant title: shows constant text.
  • constant title empty: if you want to visually connect widgets by them to be placed one under another

How does it look?

consttitle.png

emptytitle.png

How to add?

Example

Step1 Add name for title to .widget.json.

{
  "name": "MyExampleCardList",
  "title": "Constant Title",
  "type": "CardList",
  "bc": "myexample",
  "fields": [
    {
      "title": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      }
    },
    {
      "title": "Custom Field",
      "key": "customField",
      "type": "input"
    },
    {
      "title": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "card": {
      "valueFieldKey": "document",
      "titleFieldKey": "customField",
      "descriptionFieldKey": "customFieldDescription"
    },
    "create": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "edit": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "actionGroups": {
      "include": [
        "create",
        "delete"
      ]
    }
  }
}
Live Sample · GitHub

Step1 Delete parameter title to .widget.json.

{
  "name": "MyExampleEmptyTitle",
  "type": "CardList",
  "bc": "myexample",
  "fields": [
    {
      "title": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      }
    },
    {
      "title": "Custom Field",
      "key": "customField",
      "type": "input"
    },
    {
      "title": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "card": {
      "valueFieldKey": "document",
      "titleFieldKey": "customField",
      "descriptionFieldKey": "customFieldDescription"
    },
    "create": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "edit": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "actionGroups": {
      "include": [
        "create",
        "delete"
      ]
    }
  }
}
Live Sample · GitHub

Title Color

Title Color allows you to specify a color for a title. It can be constant or calculated. The title shows field values of the current record, that is of the selected card.

Constant color

Live Sample · GitHub

Constant color is a fixed color that doesn't change. It remains the same regardless of any factors in the application.

Calculated color

Live Sample · GitHub

Calculated color can be used to change a title color dynamically. It changes depending on business logic or data in the application.

Info

Title colorization is applicable to the following fields: date, dateTime, dateTimeWithSeconds, number, money, percent, time, input, text, dictionary, radio, checkbox, pickList, inlinePickList, multivalue, multivalueHover.

How does it look?

colorwidget.png

How to add?
Example

Step 1 Add custom field for color to corresponding DataResponseDTO. The field can contain a HEX color or be null.

    private String customFieldColor;

Step 2 Add "bgColorKey" : custom field for color and to .widget.json.

Add in title field with ${customField}

{
  "name": "MyExampleCardList",
  "title": "Document: ${customField}",
  "type": "CardList",
  "bc": "myexample",
  "fields": [
    {
      "title": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      }
    },
    {
      "title": "Custom Field",
      "key": "customField",
      "type": "input",
      "bgColorKey": "customFieldColor"
    },
    {
      "title": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "card": {
      "valueFieldKey": "document",
      "titleFieldKey": "customField",
      "descriptionFieldKey": "customFieldDescription"
    },
    "create": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "edit": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "actionGroups": {
      "include": [
        "create",
        "delete"
      ]
    }
  }
}

Live Sample · GitHub

Add "bgColor" : HEX color to .widget.json.

Add in title field with ${customField}

{
  "name": "MyExampleColorConst",
  "title": "Document: ${customField}",
  "type": "CardList",
  "bc": "myexample",
  "fields": [
    {
      "title": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      }
    },
    {
      "title": "Custom Field",
      "key": "customField",
      "type": "input",
      "bgColor": "#edaaa"
    },
    {
      "title": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "card": {
      "valueFieldKey": "document",
      "titleFieldKey": "customField",
      "descriptionFieldKey": "customFieldDescription"
    },
    "create": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "edit": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "actionGroups": {
      "include": [
        "create",
        "delete"
      ]
    }
  }
}

Live Sample · GitHub

Business component

This specifies the business component (BC) to which this form belongs. A business component represents a specific part of a system that handles a particular business logic or data.

see more Business component

Show condition

  • no show condition - recommended: widget always visible

Live Sample · GitHub

  • show condition by current entity: not recommended. The condition is calculated by the selected card, so the widget can hide itself when the user selects another card.

  • show condition by parent entity: condition can include boolean expression depending on parent entity. Parent field updates will trigger condition recalculation only on save or if field is force active shown on same view

Live Sample · GitHub

Tips

It is recommended not to use Show condition when possible, because wide usage of this feature makes application hard to support.

How does it look?

cardlist.png

show_cond.gif

How to add?

Example

see Basic

Step1 Add showCondition to .widget.json. see more showCondition

{
  "name": "MyExampleCardList",
  "title": "Show condition widget",
  "type": "CardList",
  "bc": "myexample",
  "showCondition": {
    "bcName": "myexample",
    "params": {
      "fieldKey": "customFieldShowCondition",
      "value": true
    }
  },
  "fields": [
    {
      "title": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      }
    },
    {
      "title": "Custom Field",
      "key": "customField",
      "type": "input"
    },
    {
      "title": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "card": {
      "valueFieldKey": "document",
      "titleFieldKey": "customField",
      "descriptionFieldKey": "customFieldDescription"
    },
    "create": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "edit": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "actionGroups": {
      "include": [
        "create",
        "delete"
      ]
    }
  }
}

Fields

Fields Configuration. The fields array defines the fields used by the cards.

{
    "title": "Document",
    "key": "document",
    "type": "fileUpload",
    "fileIdKey": "documentId",
    "preview": {
        "enabled": true,
        "mode": "inline"
    }
}
  • "title"

Description: Field Title.

Type: String(optional).

  • "key"

    Description: Name field to corresponding DataResponseDTO.

    Type: String(required).

  • "type"

Description: Field types

Type: String(required).

The widget uses only these fields:

Field Where it is shown
fileUpload preview of the card; the first fileUpload field or the field from valueFieldKey
any field from titleFieldKey title of the card
any field from descriptionFieldKey description of the card
the first dictionary field status of the card

Other fields are not shown on the card. They can be used in the create and edit form.

How to add?

Example

Add field to .widget.json.

   {
     "name": "MyExampleCardList",
     "title": "CardList",
     "type": "CardList",
     "bc": "myexample",
     "fields": [
       {
         "title": "Document",
         "key": "document",
         "type": "fileUpload",
         "fileIdKey": "documentId",
         "preview": {
           "enabled": true,
           "mode": "inline"
         }
       },
       {
         "title": "Custom Field",
         "key": "customField",
         "type": "input"
       },
       {
         "title": "Custom Field Description",
         "key": "customFieldDescription",
         "type": "input"
       }
     ],
     "options": {
       "card": {
         "valueFieldKey": "document",
         "titleFieldKey": "customField",
         "descriptionFieldKey": "customFieldDescription"
       },
       "create": {
         "widget": "MyExampleForm",
         "style": "popup"
       },
       "edit": {
         "widget": "MyExampleForm",
         "style": "popup"
       },
       "actionGroups": {
         "include": [
           "create",
           "delete"
         ]
       },
       "fullTextSearch": {
         "enabled": true,
         "placeholder": "Find by title"
       }
     }
   }

Options layout

not applicable

Actions

Actions show available actions as separate buttons see more Actions.

Record actions are shown as icons on the card. The widget actions (for example Add) are shown above the cards.

Info

All record actions of the service are shown on the card, Save and Cancel too. Leave only the needed ones with actionGroups: "actionGroups": {"include": ["create", "delete"]}.

Create

Live Sample · GitHub

Create button enables you to create a new card by clicking the Add button. The file popup opens with a form under the file: the user uploads a file, fills the fields and saves the record.

  • Inline: not applicable: an empty card has no place to upload a file.
  • With widget: Add opens a popup with an empty file preview and the form from options.create. Save creates the record, Cancel removes the new card.
  • With view: not applicable

Warning

The form must have type Form. A FormPopup is not shown in the popup.

How does it look?

create.gif

How to add?

Example

Step 1 Add action create to corresponding VersionAwareResponseService.

    @Override
    public Actions<MyExampleDTO> getActions() {
        return Actions.<MyExampleDTO>builder()
                .create(crt -> crt.text("Add"))
                .save(sv -> sv.text("Save"))
                .cancelCreate(ccr -> ccr.text("Cancel").available(bc -> true))
                .delete(dlt -> dlt.text("Delete"))
                .build();
    }

Step 2 Create a Form widget for the popup.

{
  "name": "MyExampleForm",
  "title": "",
  "type": "Form",
  "bc": "myexample",
  "fields": [
    {
      "label": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "popup"
      }
    },
    {
      "label": "Custom Field",
      "key": "customField",
      "type": "input"
    },
    {
      "label": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "actionGroups": {
      "include": [
        "save",
        "cancel-create"
      ]
    },
    "layout": {
      "rows": [
        {
          "cols": [
            {
              "fieldKey": "document",
              "span": 24
            }
          ]
        },
        {
          "cols": [
            {
              "fieldKey": "customField",
              "span": 24
            }
          ]
        },
        {
          "cols": [
            {
              "fieldKey": "customFieldDescription",
              "span": 24
            }
          ]
        }
      ]
    }
  }
}

Step 3 Add options.create and options.edit with "style": "popup" to the CardList widget.

{
  "name": "MyExampleCardList",
  "title": "CardList",
  "type": "CardList",
  "bc": "myexample",
  "fields": [
    {
      "title": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      }
    },
    {
      "title": "Custom Field",
      "key": "customField",
      "type": "input"
    },
    {
      "title": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "card": {
      "valueFieldKey": "document",
      "titleFieldKey": "customField",
      "descriptionFieldKey": "customFieldDescription"
    },
    "create": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "edit": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "actionGroups": {
      "include": [
        "create",
        "delete"
      ]
    },
    "fullTextSearch": {
      "enabled": true,
      "placeholder": "Find by title"
    }
  }
}

Step 4 Add both widgets to the .view.json.

{
  "name": "myexamplelist",
  "title": "CardList",
  "template": "DashboardView",
  "url": "/screen/myexample/view/myexamplelist",
  "widgets": [
    {
      "widgetName": "SecondLevelMenu",
      "position": 1,
      "gridWidth": 24
    },
    {
      "widgetName": "MyExampleCardList",
      "position": 10,
      "gridWidth": 24
    },
    {
      "widgetName": "MyExampleForm",
      "position": 20,
      "gridWidth": 24
    }
  ],
  "rolesAllowed": [
    "CXBOX_USER"
  ]
}

Edit

Live Sample · GitHub

With options.edit the card has the edit icon. It opens a popup with the file and the form under it. Save saves the record and closes the popup. Arrows at the bottom of the popup move to the previous or the next card.

Without options.edit the card has the eye icon. It opens the file in a popup for viewing.

How does it look?

edit.gif

view.gif

How to add?

Example

see Create, Step 2 - Step 4.

Delete

Live Sample · GitHub

The delete icon deletes the record at once, like in List.

How does it look?

delete.gif

How to add?

Example

Add action delete to corresponding VersionAwareResponseService.

    @Override
    public Actions<MyExampleDTO> getActions() {
        return Actions.<MyExampleDTO>builder()
                .create(crt -> crt.text("Add"))
                .save(sv -> sv.text("Save"))
                .cancelCreate(ccr -> ccr.text("Cancel").available(bc -> true))
                .delete(dlt -> dlt.text("Delete"))
                .build();
    }

Additional properties

Card options

Live Sample · GitHub

options.card sets which fields are shown on the card. All keys are optional.

Key What it sets Default
valueFieldKey fileUpload field of the card the first fileUpload field
titleFieldKey field for the title the file name
descriptionFieldKey field for the description no description

With a description the title and the description are cut to one line. Without a description a long title wraps to the next lines.

How to add?

Example

Add options.card to .widget.json.

{
  "name": "MyExampleCardList",
  "title": "CardList",
  "type": "CardList",
  "bc": "myexample",
  "fields": [
    {
      "title": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      }
    },
    {
      "title": "Custom Field",
      "key": "customField",
      "type": "input"
    },
    {
      "title": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "card": {
      "valueFieldKey": "document",
      "titleFieldKey": "customField",
      "descriptionFieldKey": "customFieldDescription"
    },
    "create": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "edit": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "actionGroups": {
      "include": [
        "create",
        "delete"
      ]
    },
    "fullTextSearch": {
      "enabled": true,
      "placeholder": "Find by title"
    }
  }
}

Card size

Live Sample · GitHub

The size of a card is set on the fileUpload field of the card:

  • width: the width of the card in pixels. Default: 300.
  • minRows: the height of the card in rows of 40 pixels. By default the card is square.

A row has as many cards as fit into the width of the widget, the rest go to the next rows.

Preview

Live Sample · GitHub

The card shows a preview of the file when preview of the fileUpload field has "enabled": true: a picture or the first page of a PDF. Other files are shown with the icon of their type.

  • Only "mode": "inline" is supported. Other modes also work as inline and give a warning in the browser console.
  • Without preview or with "enabled": false the card shows only the icon of the file type.

How to add?

Example

Add preview with "enabled": true and "mode": "inline" to the fileUpload field in .widget.json.

{
  "name": "MyExampleCardList",
  "title": "CardList",
  "type": "CardList",
  "bc": "myexample",
  "fields": [
    {
      "title": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      }
    },
    {
      "title": "Custom Field",
      "key": "customField",
      "type": "input"
    },
    {
      "title": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "card": {
      "valueFieldKey": "document",
      "titleFieldKey": "customField",
      "descriptionFieldKey": "customFieldDescription"
    },
    "create": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "edit": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "actionGroups": {
      "include": [
        "create",
        "delete"
      ]
    },
    "fullTextSearch": {
      "enabled": true,
      "placeholder": "Find by title"
    }
  }
}

Status

Live Sample · GitHub

Status shows the value of a dictionary field in the middle of the card, over the preview. The color of the status is set like the title color: constant bgColor or calculated bgColorKey of the dictionary field.

Info

The widget takes the first field with type dictionary. There is no parameter to choose another dictionary field.

How does it look?

status.png

How to add?

Example

Step 1 Add a dictionary field and a field for its color to corresponding DataResponseDTO.

    @SearchParameter(name = "status", provider = EnumValueProvider.class)
    private StatusEnum status;

    private String statusColor;

Step 2 Add the dictionary field with "bgColorKey" to .widget.json.

{
  "name": "MyExampleCardList",
  "title": "CardList with status",
  "type": "CardList",
  "bc": "myexample",
  "fields": [
    {
      "title": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      }
    },
    {
      "title": "Custom Field",
      "key": "customField",
      "type": "input"
    },
    {
      "title": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    },
    {
      "title": "Status",
      "key": "status",
      "type": "dictionary",
      "bgColorKey": "statusColor"
    }
  ],
  "options": {
    "card": {
      "valueFieldKey": "document",
      "titleFieldKey": "customField",
      "descriptionFieldKey": "customFieldDescription"
    },
    "create": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "edit": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "actionGroups": {
      "include": [
        "create",
        "delete"
      ]
    }
  }
}

DrillDown

Live Sample · GitHub

DrillDown allows you to navigate to another view from a card.

  • The card title gets a link icon. A click on the title opens the target view.
  • A click on other parts of the card (the preview, the description, the empty space) only selects the card, it does not open the link.
  • The target view is calculated for each card, so every card can open its own record or its own view. In the sample the title opens the form of the record of the card.

How does it look?

drilldown.gif

How to add?

Example

Step 1 Add "drillDown": true to the fileUpload field of the card in .widget.json.

{
  "name": "MyExampleCardList",
  "title": "CardList with drilldown",
  "type": "CardList",
  "bc": "myexample",
  "fields": [
    {
      "title": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      },
      "drillDown": true
    },
    {
      "title": "Custom Field",
      "key": "customField",
      "type": "input"
    },
    {
      "title": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "card": {
      "valueFieldKey": "document",
      "titleFieldKey": "customField",
      "descriptionFieldKey": "customFieldDescription"
    },
    "create": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "edit": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "actionGroups": {
      "include": [
        "create",
        "delete"
      ]
    }
  }
}

Step 2 Add fields.setDrilldown for the same fileUpload field to corresponding FieldMetaBuilder. The link is built for the record of each card.

        fields.setDrilldown(
                MyExampleDTO_.document,
                DrillDownType.INNER,
                "/screen/myexample/view/myexampleform/" + CxboxMyExampleController.myexample + "/" + id
        );

Live Sample · GitHub

Read widget

Live Sample · GitHub

Read widget shows the file of the selected card in a large view above the cards. Arrows on the large view select the previous or the next card. A picture has buttons to rotate, zoom, reset and open it in full screen.

  • The read widget is an Info or a Form widget with the same fileUpload field. Only the file preview is shown, other fields of the widget are not shown.
  • options.layout of the read widget sets the size and the place of the preview: span of the fileUpload field is its width, minRows of the field is its height. To place the preview in the middle, put the fileUpload column between two columns of other fields: the read widget shows only the file, so these columns stay empty.

How does it look?

read.gif

How to add?

Example

Step 1 Create an Info widget with the fileUpload field.

{
  "name": "MyExampleRead",
  "title": "Selected document",
  "type": "Info",
  "bc": "myexample",
  "fields": [
    {
      "label": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      },
      "minRows": 15
    },
    {
      "label": "Custom Field",
      "key": "customField",
      "type": "input"
    },
    {
      "label": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "layout": {
      "rows": [
        {
          "cols": [
            {
              "fieldKey": "customFieldDescription",
              "span": 5
            },
            {
              "fieldKey": "document",
              "span": 14
            },
            {
              "fieldKey": "customField",
              "span": 5
            }
          ]
        }
      ]
    }
  }
}

Step 2 Add options.read.widget to the CardList widget.

{
  "name": "MyExampleCardList",
  "title": "CardList with read widget",
  "type": "CardList",
  "bc": "myexample",
  "fields": [
    {
      "title": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      }
    },
    {
      "title": "Custom Field",
      "key": "customField",
      "type": "input"
    },
    {
      "title": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "card": {
      "valueFieldKey": "document",
      "titleFieldKey": "customField",
      "descriptionFieldKey": "customFieldDescription"
    },
    "actionGroups": {
      "include": [
        "delete"
      ]
    },
    "read": {
      "widget": "MyExampleRead"
    }
  }
}

Step 3 Add both widgets to the .view.json.

{
  "name": "myexamplelist",
  "title": "Read widget",
  "template": "DashboardView",
  "url": "/screen/myexample/view/myexamplelist",
  "widgets": [
    {
      "widgetName": "SecondLevelMenu",
      "position": 1,
      "gridWidth": 24
    },
    {
      "widgetName": "MyExampleCardList",
      "position": 10,
      "gridWidth": 24
    },
    {
      "widgetName": "MyExampleRead",
      "position": 20,
      "gridWidth": 24
    }
  ],
  "rolesAllowed": [
    "CXBOX_USER"
  ]
}

Filtration

not applicable

FullTextSearch

Live Sample · GitHub

FullTextSearch - when the user types in the search box of the widget, the widget shows the cards that match the search query. The service filters the records, like in List.

How does it look?

fulltextsearch.gif

see FullTextSearch

How to add?

Example

Step 1 Add fullTextSearch to options of .widget.json.

{
  "name": "MyExampleCardList",
  "title": "CardList with full text search",
  "type": "CardList",
  "bc": "myexample",
  "fields": [
    {
      "title": "Document",
      "key": "document",
      "type": "fileUpload",
      "fileIdKey": "documentId",
      "preview": {
        "enabled": true,
        "mode": "inline"
      }
    },
    {
      "title": "Custom Field",
      "key": "customField",
      "type": "input"
    },
    {
      "title": "Custom Field Description",
      "key": "customFieldDescription",
      "type": "input"
    }
  ],
  "options": {
    "card": {
      "valueFieldKey": "document",
      "titleFieldKey": "customField",
      "descriptionFieldKey": "customFieldDescription"
    },
    "create": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "edit": {
      "widget": "MyExampleForm",
      "style": "popup"
    },
    "actionGroups": {
      "include": [
        "create",
        "delete"
      ]
    },
    "fullTextSearch": {
      "enabled": true,
      "placeholder": "Find by title"
    }
  }
}

Step 2 Add the search specification to the repository.

    default Specification<MyEntity> getFullTextSearchSpecification(String value) {
        return (root, query, cb) -> FullTextSearchExt.likeIgnoreCase(value, cb, root.get(MyEntity_.customField));
    }

Step 3 Apply it in getSpecification of the service.

    @Override
    protected Specification<MyEntity> getSpecification(BusinessComponent bc) {
        var fullTextSearchFilterParam = FullTextSearchExt.getFullTextSearchFilterParam(bc);
        var specification = super.getSpecification(bc);
        return fullTextSearchFilterParam
                .map(value -> and(repository.getFullTextSearchSpecification(value), specification))
                .orElse(specification);
    }

Live Sample · GitHub

Pagination works like in List: the pagination under the cards turns the pages, 5 cards on a page by default.

How does it look?

pagination.gif

see Pagination and Default page limit

Export to Excel

not applicable

Multi-upload files

Live Sample · GitHub

We have implemented multi-file upload. You can use a dedicated drag-and-drop zone or a standard button to select your files. Every uploaded file becomes a new card.

see more Multi-upload files

Customization of displayed columns

not applicable

Sorting

not applicable