Fork me on GitHub

Developer's How-to: OpenUI Document Field Tree List Picker

This feature is available since v7.0.0. See Release Notes for detail.

Configuring OpenUI Field Extension

You should add a custom OpenUI Field Extension configuration like the following example in YAML format. This is an example called exampleCategoryPicker, as a custom REST Service for OpenUI Picker, with ../../examples/hippoblogarticles.jsp (e.g, http://localhost:8080/cms/examples/msc.jsp), which responds with a list of items or single item in JSON.

/hippo:configuration/hippo:frontend/cms/ui-extensions/exampleCategoryPicker:
  jcr:primaryType: frontend:uiExtension
  frontend:config: "{\r\n  \"findOneUrl\": \"../../examples/msc.jsp?id={{id}}\"\
    ,\r\n  \"findAllUrl\": \"../../examples/msc.jsp\",\r\n \
    \ \"treeViewMode\": true\r\n}"
  frontend:displayName: Example Category Picker
  frontend:extensionPoint: document.field
  frontend:initialHeightInPixels: 80
  frontend:url: angular/exdocpickerbase-openui/index.html
        

Configuration Parameters

Parameter name Description Default value(s)
frontend:displayName The display name of this OpenUI Extension. See Configure a Document Field Extension for detail.
frontend:extensionPoint The type of extension point. This should be set to document.field. See Configure a Document Field Extension for detail.
findOneUrl The REST API URL template, in Handlebars templating syntax, to resolve a single resource item.
Note that only id variable, which is the identifier of the specific item, is provided in templating for this URL.
See Specification of REST Services for OpenUI Document Field Picker for detail.
findAllUrl The REST API URL template, in Handlebars templating syntax, to find multiple resource items.
Note that only q variable, which is the user's input in the search textbox, is provided in templating for this URL.
See Specification of REST Services for OpenUI Document Field Picker for detail.
frontend:config The JSON string of the configuration for the frontend configuration of this plugin.
{
  "findOneUrl": "../../examples/msc.jsp?id={{id}}",
  "findAllUrl": "../../examples/msc.jsp",
  "treeViewMode": true
}

Frontend Configuration (frontend:config) Parameters

Parameter name Description Default value(s)
findOneUrl The REST API URL template, in Handlebars templating syntax, to resolve a single resource item.
Note that only id variable, which is the identifier of the specific item, is provided in templating for this URL.
As this URL template configuration is interpolated, you can configure this in multiple ways. e.g, ../../myresources/{{id}}, https://api.exmple.com/myresources/{{id}}, etc.
See Specification of REST Services for OpenUI Document Field Picker for detail.
findAllUrl The REST API URL template, in Handlebars templating syntax, to find multiple resource items.
Note that only q variable, which is the user's input in the search textbox, is provided in templating for this URL.
As this URL template configuration is interpolated, you can configure this in multiple ways. e.g, ../../myresources/, https://api.exmple.com/myresources/?query={{q}}, etc.
See Specification of REST Services for OpenUI Document Field Picker for detail.
treeViewMode Flag whether to open the flat list view picker dialog or tree list view picker dialog. This should be set to true for this tree list view picker dialog option. false

Configuring an Open UI String field in a Document Type

Once you defined a new OpenUI Extension for OpenUI External Document Field Picker followint the above instructions, you can configure document field(s) with your custom OpenUI Field Extension by setting the field type to Open UI String in any document types. See Configure a Document Field Extension for detail.

An example field configuration with the OpenUI External Document Field Picker looks like the following:

/hippo:namespaces/exdocpickerbasedemo/eventsdocument:
  jcr:primaryType: hipposysedit:templatetype
  jcr:mixinTypes: ['editor:editable', 'mix:referenceable']
  jcr:uuid: 08c73691-c539-4b63-81f6-81a3403c55c7
  /hipposysedit:nodetype:
    jcr:primaryType: hippo:handle
    jcr:mixinTypes: ['mix:referenceable']
    jcr:uuid: 003586bb-c610-48c9-9faa-64805e3b7179
    /hipposysedit:nodetype:
      jcr:primaryType: hipposysedit:nodetype
      jcr:mixinTypes: ['hipposysedit:remodel', 'mix:referenceable']
      jcr:uuid: e84b7e04-6978-4e73-a001-2fc8ff6f44a0
      hipposysedit:node: true
      hipposysedit:supertype: ['exdocpickerbasedemo:basedocument', 'hippostd:relaxed',
        'hippotranslation:translated']
      hipposysedit:uri: http://www.exdocpickerbasedemo.com/exdocpickerbasedemo/nt/1.0
      # ...SNIP...
      /relatedcategoryid:
        jcr:primaryType: hipposysedit:field
        hipposysedit:mandatory: false
        hipposysedit:multiple: false
        hipposysedit:ordered: false
        hipposysedit:path: exdocpickerbasedemo:relatedcategoryid
        hipposysedit:primary: false
        hipposysedit:type: OpenUiString
      # ...SNIP...
  /editor:templates:
    jcr:primaryType: editor:templateset
    /_default_:
      jcr:primaryType: frontend:plugincluster
      frontend:properties: [mode]
      frontend:references: [wicket.model, model.compareTo, engine, validator.id]
      frontend:services: [wicket.id, validator.id]
      type: exdocpickerbasedemo:eventsdocument
      # ...SNIP...
      /relatedcategoryid:
        jcr:primaryType: frontend:plugin
        caption: Related Category
        field: relatedcategoryid
        plugin.class: org.hippoecm.frontend.editor.plugins.field.PropertyFieldPlugin
        wicket.id: ${cluster.id}.right.item
        /cluster.options:
          jcr:primaryType: frontend:pluginconfig
          ui.extension: exampleCategoryPicker
      # ...SNIP...