Apply sorted tree nodes to siteadmin 'redirect' pathfield | Community
Skip to main content
Level 3
October 16, 2015
Solved

Apply sorted tree nodes to siteadmin 'redirect' pathfield

  • October 16, 2015
  • 14 replies
  • 3249 views

Our customer wants to be able to see tree nodes in alphanumeric order in the pathfield dialog from the 'redirect' field on the siteadmin page properties dialog. I found an article here - http://experience-aem.blogspot.com/2014/04/aem-cq-56-sort-tree-nodes-of-browse-dialog-pathfield.html - that shows what appears to be a pretty simple solution to what our customer wants. I've been struggling with this for a couple of days but can't seem to find the right solution to add the listener described in the article to the built-in siteadmin page. I tried copying /libs/foundation/component/page component to /apps/foundation/component/page and applying the listener and additional javascript there but that didn't work.

What is the best way to accomplish what I need?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by edubey

While creating template is AEM we usually inherit the functionality from OOTB page component on top of which we add our own files.

So in all at the end /libs/foundation/components/page will be rendering. Now here is the point, have you override dialog of OOTB page component.

Can you see dialog at /apps/history/pages/page path ?

Here is great article by Adobe : https://docs.adobe.com/docs/en/cq/5-6-1/howto/website.html

14 replies

Level 3
October 16, 2015

The problem was that the dialog was already in our /apps/history/pages/page directory. I just hadn't realized that there were already customizations that had been made. Thanks for the help!

edubey
edubeyAccepted solution
Level 10
October 16, 2015

While creating template is AEM we usually inherit the functionality from OOTB page component on top of which we add our own files.

So in all at the end /libs/foundation/components/page will be rendering. Now here is the point, have you override dialog of OOTB page component.

Can you see dialog at /apps/history/pages/page path ?

Here is great article by Adobe : https://docs.adobe.com/docs/en/cq/5-6-1/howto/website.html

Level 3
October 16, 2015

It appears that my page component is not being rendered. I changed the label on the redirect field to 'RedirectMe' but that's not what I see when I open the properties dialog. I'm still seeing 'Redirect'. So I guess the question is: why is the system not seeing my version of the component?

 

Thanks for the help!

Level 3
October 16, 2015

Here's the structure of the page:

/apps/history/templates/redirectpage has sling:resourceType of /apps/history/pages/redirectpage

/apps/history/pages/redirectpage has sling:resourceSuperType of /apps/history/pages/page

/apps/history/pages/page has sling:resourceSuperType of foundation/components/page

I've created a couple of new pages using this template and it still seems that the page is being rendered by /libs/foundation/components/page. I even set the sling:superResourceType in /apps/history/pages/page to /apps/foundation/components/page and it still does not seem to be using the apps version to render the page.

Kunal_Gaba_
October 16, 2015

Did you create a cq:Template node in /apps and set  jcr:content/sling:resourceType to foundation/components/page ? See the Geometrixx example here - /apps/geometrixx/templates/contentpage. Also, you will have to create a new page with this template and check it's properties in siteadmin interface. 

Level 3
October 16, 2015

I do see my clientlibs in the Client Libraries dump:

     
cq.widgets/apps/cq/ui/widgets
/apps/foundation/components/page/clientlibs
/apps/history/sort-pathfield-tree/clientlib

 

I also put an alert message at the top of the sort function and cleared my browser cache, but it still doesn't get loaded.

Kunal_Gaba_
October 16, 2015

Check if your custom page component dialog is getting rendered or not. Try changing the label of the redirect field and see if you can see the new label in the dialog. 

Also, enable client library debugging by checking the Debug checkbox here - "http://localhost:5502/system/console/configMgr/com.adobe.granite.ui.clientlibs.impl.HtmlLibraryManagerImpl"

And then refresh your browser and open page properties. Open browser developer tools (ex- FF firebug) and see if you can see the javascript path in the sources section - /apps/foundation/components/page/clientlibs/sort-tree-node.js

Disable the checkbox after debugging as it will slow down the page rendering performance. 

Kunal_Gaba_
October 16, 2015

You can validate that whether your JS client library is registered or not. Open the following URL - http://localhost:4502/libs/granite/ui/content/dumplibs.html#cq.widgets and see whether you see you see the path of the clientlib folder /apps/foundation/components/page/clientlib in the second column. 

If you don't see that then make sure that the jcr:primaryType of clientlib folder is "cq:ClientLibraryFolder" and you have added a multi valued property named "categories" and set its value to "cq.widgets". In js.txt just add the name of the js file - "sort-tree-nodes.js"

Clear your browser cache and then test again. You can also try adding some alert or log statements in the JS to rule out any javascript errors. 

Level 3
October 16, 2015

The JS does exist in the component but I can't determine that it's actually being loaded. Here's a screenshot of my component in CRXDE:

[img]Screen Shot 2015-09-01 at 1.01.12 PM.png[/img]

I tried putting an alert at the top of the JS (not there in the screenshot) but it doesn't seem to be getting executed.

 

Thanks!

edubey
Level 10
October 16, 2015

As suggested in the article, have you followed step 1 to step 4.?

Can you ensure that JS present in step 4 is getting load not necessary via listener.Whether its that part of JS files or not?