Wednesday, 8 October 2014

Component Group not visible in AEM Sidekick

In this post, I will address a common issue which we face when we create a component with new group. 
Sometime it happens that we create a component using CRXDE Lite and defined a new group there & when we go to our web page sidekick in design mode, we are not able to see this component group there. 
Most of AEM developers are suffering with this common issue and we are not able to find why this group not visible in sidekick. In this post, I will show you what common mistake we did while we create a component using CRXDE Lite. So

1).  Why Component group not visible in sidekick?
2).  How to resolve this issue?
3).  How to make it work as it is i.e. without changing in component?

NOTE: - 
This problem is present in CQ5.x as well as AEM6 so it's solution work for all CQ5.x and AEM6 version.

For addressing this issue I just create a new component with these properties - 

Everything is looking right but when I go to your web page sidekick in edit mode, click on parsys edit button, in this list are not able to see this component group.

Cause of this issue.
My finding tells that jcr:title property started with small letter, So that it's not visible in sidekick.

Just change this property value "blog" with "Blog" & again go to your web page. First clear your Browser cache, then refresh your web page. goto sidekick. Here it is, your component is visible here.

Convention to create new Component According to my findings
As you see there are lot of groups present in sidekick, all are started with capital letter, so you just follow these assumption while creating new component - 

1). Keep  jcr:title property values Starting with a capital letter. It's a mandatory property for displaying this component group in sidekick.

2). Keep componentGroup property starting with capital letter, while it's not mandatory but for displaying it in sorted order in sidekick, it's good to have it. if you don't define this property then this component will be visible under "NO GROUP DEFINED!" component group.

How to make it work without changing these properties?
Some of my colleagues ask me that we don't want to change these properties then how to use this component group.
Answer is when you select a group from sidekick then it's value will be stored at template node under design page jcr:content node. This design page  property is a template level property and present at jcr:content node of your template. If you don't define this property then AEM create a nt:unstructured node under /etc/designs/default/jcr:content node having name same as of your template name.

In my case, I don't define any design page property so I have my design level properties under /etc/design/default/jcr:content node, with a name of my template name (homepage). This node is of type nt:unstructured.
Under this node we have different node for different parsys, just go to any parsys node in my case it is par as displayed - 

Select your par node, here you will see some properties on your right panel of screen.

it looks like - 

If you select any of group like General or any other then you will see components property but if you don't select any of group then this property will not be displayed. If you don't have this property then Just create this property as string array and set it's value having syntex

Syntex - I
group:<new group name>
in my case it is 

Syntex - II
Copy and paste relative path or absolute path of your component. In my case it is 
Here no need to define group: prefix.

Save it, goto your web page, clear browser cache, and reload the page now you are able to see you component group in sidekick. This is the fix only but if you want to remove it from sidekick then it's not possible to directly uncheck from sidekick as it is not visible in that list, So you have to do it manually.

Happy Coding 
Namah Shivay

No comments:

Post a Comment