Expand my Community achievements bar.

SOLVED

CQ.WCM.isSidekickReady() not working

Avatar

Former Community Member

I am trying to add some custom handling to the Sidekick and I am following this example: http://adobecms.blogspot.ca/2014/04/sidekick-customization.html

I've included this code in my component.jsp:

<script> function checkSidekickStatus() { if (CQ.WCM.isSidekickReady()) { // do stuff clearTimeout(timeout); } } var timeout = setInterval(checkSidekickStatus, 1000); </script>

But, it never gets past the "CQ.WCM.isSidekickReady()" check, even though the Sidekick is clearly ready.  Any suggestions?

1 Accepted Solution

Avatar

Correct answer by
Level 10

albinomouse wrote...

Where should I place my code to ensure that it is called at the correct time?

When I do the simple example I posted above, I do not get an error message in the console: 

  1. function checkSidekickStatus() {
  2.     if (CQ.WCM.isSidekickReady()) {
  3.     console.log("I'm ready");
  4. clearTimeout(timeout);
  5.     }
  6. }
  7. var timeout = setInterval(checkSidekickStatus, 1000);

But I don't get my console log message either.  If it is in the jsp, shouldn't it run when I add my component to the page?

What I would like, in the end, is to have an EditConfig listener on "afterinsert" which calls a method to disable some buttons on the Sidekick after inserting this component to a page.

 

For your usecase follow http://experience-aem.blogspot.com/2013/08/get-sidekick-instance-and-disable.html

View solution in original post

4 Replies

Avatar

Level 10

It should work. You might be calling before library is loaded. As Ove suspected you should see cq undefined etc.. error in javascript console.

Avatar

Level 6

Hi,

do you get any errors in the Javascript console? I tried the same thing and it works. At least in Chrome.

/O

Avatar

Former Community Member

Where should I place my code to ensure that it is called at the correct time?

When I do the simple example I posted above, I do not get an error message in the console: 

function checkSidekickStatus() {     if (CQ.WCM.isSidekickReady()) {     console.log("I'm ready"); clearTimeout(timeout);     } } var timeout = setInterval(checkSidekickStatus, 1000);

But I don't get my console log message either.  If it is in the jsp, shouldn't it run when I add my component to the page?

What I would like, in the end, is to have an EditConfig listener on "afterinsert" which calls a method to disable some buttons on the Sidekick after inserting this component to a page.

Avatar

Correct answer by
Level 10

albinomouse wrote...

Where should I place my code to ensure that it is called at the correct time?

When I do the simple example I posted above, I do not get an error message in the console: 

  1. function checkSidekickStatus() {
  2.     if (CQ.WCM.isSidekickReady()) {
  3.     console.log("I'm ready");
  4. clearTimeout(timeout);
  5.     }
  6. }
  7. var timeout = setInterval(checkSidekickStatus, 1000);

But I don't get my console log message either.  If it is in the jsp, shouldn't it run when I add my component to the page?

What I would like, in the end, is to have an EditConfig listener on "afterinsert" which calls a method to disable some buttons on the Sidekick after inserting this component to a page.

 

For your usecase follow http://experience-aem.blogspot.com/2013/08/get-sidekick-instance-and-disable.html