DevelopWidgets
Item list
Shows the Items of the kinds you choose as cards for the user to search and pick, and starts a new one. The result comes back as the messages select and create.
The item-list widget shows the Items that the user can reach, in every folder, and sends the Item the user picks back to your page.
URL and parameters
The widget is at <site>/widgets/item-list. The parameters every widget takes are in Widgets.
| Parameter | Meaning | Required |
|---|---|---|
types | The types of Item to show, separated by commas, for example form. Without it, every type. | No |
subtypes | The subtypes to show, separated by commas. | No |
creatable_types | The types that get a card to start a new Item. webMap, application and form work. Separated by commas. | No |
creatable_subtypes | The page takes it but does not use it. | No |
Messages
| action | Direction | payload |
|---|---|---|
select | widget to your page | The Item the user pressed, as the Item's JSON. Use _id and name. |
create | widget to your page | { type }, the type of the new-Item card the user pressed. |
This widget does not send ready and does not read post-widget-parameters. Put every value in the URL. It sends error and close-with-error as in Widgets.
The widget does not create the Item. create only says which type the user wants, and you create it.
Example
embedParams is the common parameters from Widgets.
const params = new URLSearchParams({
...embedParams,
types: 'form',
creatable_types: 'form',
})
frame.src = `${site}/widgets/item-list?${params}`
addEventListener('message', (e) => {
if (e.origin !== site || e.data.messageToken !== messageToken) return
if (e.data.action === 'select') openForm(e.data.payload._id)
if (e.data.action === 'create') newForm()
})