我正在使用触摸UI组件,我在AEM 6中创建了一个对话框。我需要在触摸对话框中创建2个单选按钮,如果选择了其中任何一个,则所选的收音机的相应值应显示按钮。但是,我不了解如何创建单选按钮选项。我在经典对话框中实现了相同的选项,其中使用了xtype = selection和type = radiogroup,但我不明白如何在触摸对话框中创建它
答案 0 :(得分:6)
这是CoralUI v1 / v2的无线电组示例。 radiogroup
是可选的,radio
小部件本身仍然可以使用。只有在您想为该组添加标签时才需要该组。
<radioGroup jcr:primaryType="nt:unstructured"
name="./type"
text="Fruit"
required="{Boolean}true"
sling:resourceType="granite/ui/components/foundation/form/radiogroup"
renderReadOnly="{Boolean}true">
<items jcr:primaryType="nt:unstructured">
<radioApple jcr:primaryType="nt:unstructured"
name="./fruit"
text="Apple"
value="apple"
cq-msm-lockable="fruit"
sling:resourceType="granite/ui/components/foundation/form/radio"
renderReadOnly="{Boolean}true"/>
<radioPear jcr:primaryType="nt:unstructured"
name="./fruit"
text="Pear"
value="pear"
cq-msm-lockable="fruit"
sling:resourceType="granite/ui/components/foundation/form/radio"
renderReadOnly="{Boolean}true"/>
<radioDefaultValue jcr:primaryType="nt:unstructured"
name="./fruit@DefaultValue"
value="apple"
sling:resourceType="granite/ui/components/foundation/form/hidden"/>
<radioDefaultWhenMissing jcr:primaryType="nt:unstructured"
name="./fruit@UseDefaultWhenMissing"
value="true"
sling:resourceType="granite/ui/components/foundation/form/hidden"/>
</items>
</radioGroup>
注意:如果您需要在之前设置的默认值,您甚至可以打开对话框,那么您需要在模板中定义它(如果它是页面对话框)或对于组件。
对于组件,要将默认值设置为apple
,您可以在.content.xml
中添加:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Component"
jcr:title="Fruit Component"
componentGroup="My App Group"
sling:resourceSuperType="foundation/components/parbase">
<cq:template jcr:primaryType="nt:unstructured" fruit="apple"/>
</jcr:root>
另见:
如果您正在为AEM 6.3开发,那么您将需要所有组件的CoralUI3风格,即代替
granite/ui/components/foundation/form/radio
,您应该使用granite/ui/components/coral/foundation/form/radio
等。有关迁移到CoralUI 3的详细信息,请参阅https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/granite-ui/api/jcr_root/libs/granite/ui/components/legacy/coral2/migration.html。
答案 1 :(得分:4)
您可以使用Form Input - Radio。要创建单选按钮组,请为所有单选按钮指定相同名称。 Radio输入的resourceType是/libs/granite/ui/components/foundation/form/radio
。
节点的Json示例:
"hideinnav": {
"jcr:primaryType": "nt:unstructured",
"name": "./hideInNav",
"text": "Hide in Navigation",
"value": "true",
"cq-msm-lockable": "hideInNav",
"sling:resourceType": "/libs/granite/ui/components/foundation/form/radio",
"renderReadOnly": true
},
"showinNav": {
"jcr:primaryType": "nt:unstructured",
"name": "./hideInNav",
"text": "Show in Navigation",
"value": "false",
"cq-msm-lockable": "hideInNav",
"sling:resourceType": "/libs/granite/ui/components/foundation/form/radio",
"renderReadOnly": true
}
与在选项节点下设置按钮的经典UI选择小部件不同,单选按钮是独立的,可以直接在容器中使用。
答案 2 :(得分:0)
珊瑚UI3不再支持单个表格/广播。现在已由表单/无线电组替换 https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/reference-materials/granite-ui/api/jcr_root/libs/granite/ui/components/legacy/coral2/migration.html
在Coral UI3中,要创建两个单选按钮,您可以执行以下操作:
<radioGroup
jcr:primaryType="nt:unstructured"
name=“./state“
text=“Select an Option”
sling:resourceType="granite/ui/components/coral/foundation/form/radiogroup">
<items jcr:primaryType="nt:unstructured">
<radioExpanded jcr:primaryType="nt:unstructured"
text="Expanded"
value="expanded”/>
<radioCollapse
jcr:primaryType="nt:unstructured"
text=“Collapse”
value=“collapse”/>
</items>
</radioGroup>
答案 3 :(得分:-2)
AEM 6 Touch UI不支持单选按钮组。相反,你可以使用下拉列表? 吊索:= resourceType为&#34;花岗岩/ UI /组件/基础/形式/下拉&#34;