CQ5。在对话框中使用pathField xtype

时间:2014-03-26 14:18:14

标签: dialog components cq5

我想在我的组件的对话框中使用pathfield。

根据link

我添加了

<myPathComponent
        jcr:primaryType="cq:Widget"
        fieldLabel="My path component"
        plugins="customRootPathPlugin"
        xtype="pathfield" />

到我的dialog.xml

我尝试了不同的varians:

1

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:Dialog"
    title="Example Component Dialog"
    xtype="dialog">
    <items
        jcr:primaryType="cq:Widget"
        xtype="tabpanel">
        <items jcr:primaryType="cq:WidgetCollection">
            <tab1                
             <myPathComponent
                  jcr:primaryType="cq:Widget"
                  fieldLabel="My path component"
                  plugins="customRootPathPlugin"
                  xtype="pathfield" />

            />
        </items>
    </items>
</jcr:root>

2

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:Dialog"
    title="Example Component Dialog"
    xtype="dialog">
    <items
        jcr:primaryType="cq:Widget"
        xtype="tabpanel">
        <items jcr:primaryType="cq:WidgetCollection">

             <myPathComponent
                  jcr:primaryType="cq:Widget"
                  fieldLabel="My path component"
                  plugins="customRootPathPlugin"
                  xtype="pathfield" />


        </items>
    </items>
</jcr:root>

3

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:Dialog"
    title="Example Component Dialog"
    xtype="dialog">
    <items
        jcr:primaryType="cq:Widget"
        xtype="tabpanel">


             <myPathComponent
                  jcr:primaryType="cq:Widget"
                  fieldLabel="My path component"
                  plugins="customRootPathPlugin"
                  xtype="pathfield" />



    </items>
</jcr:root>

4

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:Dialog"
    title="Example Component Dialog"
    xtype="dialog">



             <myPathComponent
                  jcr:primaryType="cq:Widget"
                  fieldLabel="My path component"
                  plugins="customRootPathPlugin"
                  xtype="pathfield" />




</jcr:root>

5

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"



             <myPathComponent
                  jcr:primaryType="cq:Widget"
                  fieldLabel="My path component"
                  plugins="customRootPathPlugin"
                  xtype="pathfield" />




</jcr:root>

仅在某些情况下,在按组件双击后,我会看到组件反应。但是有空列表:

enter image description here

我需要阅读哪些内容才能解决我的问题?

1 个答案:

答案 0 :(得分:0)

链接的答案介绍了如何实现动态路径域(例如,允许根据当前站点设置不同的根路径)。如果您想创建一个包含单个普通路径域窗口小部件的对话框,则以下代码将执行:

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root 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="cq:Dialog"
  title="Simple dialog"
  xtype="dialog">
  <items jcr:primaryType="cq:WidgetCollection">
    <tabPanel
      jcr:primaryType="cq:TabPanel"
      xtype="tabpanel">
      <items jcr:primaryType="cq:WidgetCollection">
        <tab1
          jcr:primaryType="cq:Widget"
          anchor="100%"
          title="General"
          xtype="panel">
          <items jcr:primaryType="cq:WidgetCollection">
            <myPathComponent
              jcr:primaryType="cq:Widget"
              fieldLabel="My path component"
              xtype="pathfield" />
          </items>
        </tab1>
      </items>
    </tabPanel>
  </items>
</jcr:root>