3 Replies Latest reply on Apr 27, 2013 7:31 PM by Sham HC

    Adding a button to the sidekick toolbar


      I've been attempting to add new "page preview" functionality to the sidekick by adding a new button to the sidekick's bottom toolbar. So far i haven't had a problem adding the button and assigning a corresponding menu with events. The trouble i've run into is that when the page is loaded with the content finder, the menu object isn't found because it was created at the page level. I have something like this in a design/clientlibs file -


              "iconCls": "cq-sidekick-preview",
              "tooltip": {
                  "title": "New Preview",
                  "text": "Switch to new preview mode",
                  "autoHide": true
              "pressed": CQ.WCM.isPreviewMode(),
              "toggleGroup": "wcmMode",
              "enableToggle": true,
              "scope": this,
              menu: new CQ.Ext.menu.Menu({
                  id: 'mainMenu',
                  items: [
                      { "iconCls":"revertIcon",
                          "cls": "cq-userinfo-revert",
                          "handler": function () {newPreview("Test1");}
                      ... Additional items ...


      This works perfectly when i go straight to the page, but when opening with the content finder the button throws an error trying to position the menu -


      uncaught exception: Element.alignToXY with an element that doesn't exist


      I think this is because the javascript ran in an iframe and the menu object somehow doesn't exist anymore? Does anyone have any ideas how i can get around this or if there is a better way for me to implement a new button? I know i could easily edit the source of the sidekick.js file but i was hoping to find a way that would only effect one site.