如何在aem 6触摸对话框中创建单选按钮

Sur*_*dra 3 dialog aem sightly htl

我有一个触摸UI组件,我正在AEM 6中创建一个对话框.我需要在触摸对话框中创建2个单选按钮,如果其中任何一个被选中,则所选单选按钮的相应值应为显示.但是,我不了解如何创建单选按钮选项.我在经典对话框中实现了相同的选项,其中使用了xtype = selection和type = radiogroup,但我不明白如何在触摸对话框中创建它在此输入图像描述

ccp*_*zza 7

这是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>
Run Code Online (Sandbox Code Playgroud)

注意:如果打开对话框之前需要设置默认值,则需要在模板中定义(如果是页面对话框)或组件.

对于组件,要将默认值设置为,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>
Run Code Online (Sandbox Code Playgroud)

也可以看看:

注意:

如果您正在为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.