2

I have a list, where I wish to display a Custom Action button. This is easy enough to do in SPD, but the catch is, I only want to display this Custom Action button for a specific view, not the default "All Items" view.

I am seeing no obvious way to achieve this. Even going deep into the Visual Studio 2010 end with custom Ribbon buttons I am only finding a way to associate them with a list and not a specific view witin that list.

Is there a way to bind a Custom Action button to a specific view, and not just the list as a whole?

This is for SP2010 Server.

1 Answer 1

1

I'm not sure if this solution is possible in SPD. But in xml definition you can use EnabledScript parameter in CommandUIHandler, where you can put javascript code and check if specific page/list/view is loaded.

link to similar answer

Example:

<CommandUIHandler 
  Command="Ribbon.ListItem.CustomGroup.Controls.BtnSayHello.Command"
  CommandAction="javascript:alert('Hello');"
  EnabledScript="javascript:
    function isEnable(){
      if(location.href.indexOf('AllItems.aspx') > 0){
        return true;
      }
      return false;
    }
    isEnable();"
/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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