1

I recreated a few buttons from the ribbon; I used the same XML to define the buttons.

The OOTB buttons are located on the ribbon in the contextual tab in lists. I want to take a few buttons like Navigate Up and Current view + dropdown list and place them on the item tab.

I have replicated the buttons, and it works very well since I see them.

But I've encountered an issue with the functionality; the new buttons do not work at all. The Navigate Up button is always greyed out. And the current view dropdown menu is empty and doesn't show anything. I left the commands for the buttons the same, so it seems like it should work.

I think there is something amiss with the functionality. Does anyone know what exactly could cause this problem and how to solve it?

Another problem is that when these buttons are shown, the OOTB current view dropdown in the list tab doesn't show other views - even if they are available. It just doesn't open.

Update: Just to clerify, here is an example of the button which i copied from CMDUI.XML

          <Button
          Id="Ribbon.Documents.CustomGroup.NavigateUp"
          Sequence="40"
          Command="NavigateUp"
          Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png" Image16by16Top="0" Image16by16Left="-56"
          Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png" Image32by32Top="-64" Image32by32Left="0"
          LabelText="$Resources:core,cui_ButNavigateUp;"
          ToolTipTitle="$Resources:core,cui_ButNavigateUp;"
          ToolTipDescription="$Resources:core,cui_STT_ButNavigateUp;"
          TemplateAlias="o1"
          />

So this has a command "NavigateUp", this command is called from SP.Ribbon.js. But in my case nothing happens.

2 Answers 2

0

You need to check the CommandUIHanlder and do the following:

-Make sure the javascript funciton is available in the current view. You can find the javascript function your button is calling by looking at the button definition's EnabledScript and CommandAction properties. You can find out if they are included by doing a search for the appropriate JS functions using your developer tools.

-If the code is there you need to debug and see what's going on. You can do that with IE developer tools or firebug as well.

The command UIHandler should look something like this

   <CommandUIHandlers>
        <CommandUIHandler 
          Command="NewRibbonButtonCommand"
          CommandAction="javascript:alert('Hello, world');" />
          EnabledScript=""
     </CommandUIHandlers>

The EnabledScript gets run when the ribbon loads and determins whether your button should be active or grayed out.

The CommandAction runs when your button is clicked. Hope this helps.

Both will have the JS function calls. You need to look for those functions and debug. Hopef that helps.

For more info on CommandUIHandler visit here

3
  • But why would i do that, if i copy the xml from the CMDUI.XML where all the ribbon buttons are defined and it says for exmaple button navigateup command: navigateUp. And there is no handler, as everything is written in sp.ribbon.js, so when i check the sp.ribbon.js i see that it exists, but i cannot use the same approach
    – Shkipper
    Commented Sep 12, 2012 at 13:24
  • The xml you posted is only part of the definition. Visit here for a quick walkthrough. I think that will clear things up on how this all works.
    – mhijazi
    Commented Sep 12, 2012 at 13:32
  • Look for the CommandUIHandler with Command="NavigateUp" in the CMDUI.XML file
    – mhijazi
    Commented Sep 12, 2012 at 13:37
0

I solved my problem by removing the following from my group definition:

Command="EnableCustomGroup"

I don't know what it does, but it prohibited the buttons to work. Removing did everything to fly!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.