Skip navigation
Currently Being Moderated

Dynamically setting the rootPath property for the xtype = pathfield

May 18, 2012 9:14 AM

If I set the property rootPath = content/training, then the my fieldConfig widget, xtype=pathfield will allow the user to set the page path from /content/training

 

I want to set it dynamically to my actual page path

 

Here is my dialog.xml file

<?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="Path Multifield"

    xtype="dialog">

    <items

        jcr:primaryType="cq:Widget"

        xtype="tabpanel">

        <items jcr:primaryType="cq:WidgetCollection">

            <tab1

                jcr:primaryType="cq:Panel"

                title="Tab 1">

                <items jcr:primaryType="cq:WidgetCollection">

                    <multipath

                        jcr:primaryType="cq:Widget"

                        fieldLabel="Sessions:"

                        name="./paths"

                        xtype="multifield">

                        <fieldConfig

                            jcr:primaryType="nt:unstructured"

                            itemId="sessionPath"                         

                            xtype="pathfield"/>

                    </multipath>

                </items>

            </tab1>

        </items>

    </items>

</jcr:root>

 

In my component.jsp I have th following code

 

<%@include file="/libs/foundation/global.jsp"%>

<%

String[] paths=properties.get("paths",String[].class);

out.write("<h2>Component</h2><br>");

 

%>

 

Current Page Path = ${currentPage.path}

<script>

        // provide a path selector field with a repository browse dialog

var pathfield = new CQ.form.PathField({

    rootPath: ${currentPage.path},

    predicate: "nosystem",

    showTitlesInTree: false

});

</script>

 

What do I have to do to get the Ext JS to work and dynamically set the rootPath

 

 

Thanks

Tyrone

 

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points