我正在尝试在此处进行 multifield 组件。当我在字段中输入值时,它们会显示在页面上,并且一切正常。当我重新打开组件以编辑现有数据时,它是空的,就像根本没有输入任何值(它们仍然出现在站点上)一样。 这是我的dialog.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" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Multifield TouchUI Component"
sling:resourceType="cq/gui/components/authoring/dialog"
helpPath="en/cq/current/wcm/default_components.html#Text">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<fieldset
jcr:primaryType="nt:unstructured"
jcr:title="Footer"
sling:resourceType="granite/ui/components/foundation/form/fieldset">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<dashboard
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldDescription="Enter Headline"
fieldLabel="Headline"
name="./headline"/>
<groups
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/multifield"
class="full-width"
fieldDescription="Click '+' to add a new page"
fieldLabel="Groups">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/fieldset"
eaem-nested=""
name="./groups">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
method="absolute"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<country
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldDescription="Enter headline of this group"
fieldLabel="Headline"
name="./headline"/>
<states
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/multifield"
class="full-width"
fieldDescription="Click '+' to add a new page"
fieldLabel="Sites">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/fieldset"
name="./sites">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
method="absolute"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<state
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldDescription="Enter name of specific site"
fieldLabel="Site Name"
name="./site"/>
<path
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/pathbrowser"
fieldDescription="Select Path"
fieldLabel="Path"
name="./path"
rootPath="/content"/>
</items>
</column>
</items>
</field>
</states>
</items>
</column>
</items>
</field>
</groups>
</items>
</column>
</items>
</fieldset>
</items>
</column>
</items>
</content>
</jcr:root>
我知道有一些使用 widgets,xtype和ext.js (ClassicUI)的解决方案,但是我想使用花岗岩/珊瑚(TouchUI)来实现。在研究过程中,问题在于我应该将每个字段的值另存为子节点,但是我不明白怎么做,因为(与我注意到的一样)示例与上面提供的代码相同。
如果该示例没有帮助,那么如果有人分享他们的 multifield 组件解决方案,实际上可以节省内容作者的输入,我也将不胜感激。
此外,如果有人认为 TouchUI 中没有此类选项,请随时发表评论,尽管这没有任何意义。
答案 0 :(得分:1)
我对Multifields也有类似的问题,我发现的唯一解决方法是使用组件/ 珊瑚 /基础的Multifield,并在该Multifield中仅添加同一组的字段。
尝试一下:
<GridLayout tkExampleTitle tkToggleNavButton>
<app-action-bar [title]="title"></app-action-bar>
<RadListView [items]="dataItems" id="rlv">
<ng-template tkListItemTemplate let-item="item">
<StackLayout orientation="vertical">
<GridLayout columns="auto">
<app-widgets-picker horizontalAlignment="left" [widget]="item"></app-widgets-picker>
</GridLayout>
</StackLayout>
</ng-template>
<ListViewLinearLayout *appIfIos tkListViewLayout itemHeight="250"></ListViewLinearLayout>
</RadListView>
</GridLayout>
答案 1 :(得分:1)
我今天遇到了相同(或相似)的问题。对我来说,事实证明我需要将composite="{Boolean}true"
属性添加到我的多字段中。复合多字段可以处理一个字段集中的多个字段。
以您的代码为例:
<states
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/multifield"
class="full-width"
fieldDescription="Click '+' to add a new page"
fieldLabel="Sites"
composite="{Boolean}true">
此post解释得很好