3 Replies Latest reply on Nov 27, 2012 8:08 PM by rush_pawan

    How do I programatically add cq components sharing design dialog but having individual dialog

    Dominic006 Level 1

      How do I programatically add cq components sharing design dialog but having individual dialog ?

       

      By dragging and dropping the component in author mode does what I am intending to do but when i do a programtical include e.g.

       

      <cq:include path="mycomponent_0" resourceType="cx/components/mycomponent" />

      <cq:include path="mycomponent_1" resourceType="cx/components/mycomponent" />

       

      The design dialog values for these 2 components are seperated.

       

      Thanks alot

        • 1. Re: How do I programatically add cq components sharing design dialog but having individual dialog
          rush_pawan Level 4

          So its not something you have to do programatically but its component design. Every time when you author any component (using "dialog") via drag and drop the component on page (creating instance at page level) or directly including component using code (template level) it associates information to individual page but when you author component using design_dialog it associates information at template level and share to all pages.

           

          To achieve common sharing at all pages (template level) you have to add design_dialog (similar to dialog you can design) node at your component and then you can author it via going to page design mode (from sidekick at the bottom bar).

           

          Please refer

           

          1. /libs/foundation/components/title     component which will give you idea about how you can design the component using design_dialog and it will also have code to how to fetch data information which set at design level (template level)

          2. http://dev.day.com/docs/en/cq/current/howto/components_develop.html to understand more about design dialog.

           

           

          Let me know if it doesn't help you.

          • 2. Re: How do I programatically add cq components sharing design dialog but having individual dialog
            Dominic006 Level 1

            Thanks for the clarification Rush. I'm aware of the design of the dialog and design dialog for components. However i'm in this situation where i am adding dynamic amount of the same component into a page.

             

            How i am achieving this is something like

            <%

            for(int i=0;i<xamount;i++){

            String includePath = "mycomponentname_" + i;

            %>

            <cq:include path="<%=includePath%>" resourceType="cx/components/mycomponent" />

            <%}%>

             

            However the components that are dynamically added do not seem to share the design dialog as compared to when drag and drop the components in manually. Am i doing the dynamic include of the components wrongly ?

             

            Thanks

            • 3. Re: How do I programatically add cq components sharing design dialog but having individual dialog
              rush_pawan Level 4

              Hi,

               

              So here is the thing which i can think of by above example you are missing. Design dialog is specific to component instance but share accross pages which are using same template. what does that mean is if you are adding multiple instance of same component (on page) then each instance will have it own separate design dialog configuration (sets at template level) but when you configure this design dialog on one page of that template then all other pages (using same template) will share same design configuration info corresponding to each component instance.

               

              I hope it clarifies your doubt about component instance design configuration. Let me know for more information.

               

              Thanks,

              Pawan