locked
Custom Ribbon RRS feed

  • Question

  • hey,

    is it possible to make a custom ribbon tab only available in a special list?

     

    e.g. i have two discussionboards

    to enable a ribbontab in a discussionboard the RegistrationId="108"

    but then, this tab is available in both boards

     

    is there a chance to enable it only in one board?

    Thursday, August 5, 2010 1:08 PM

Answers

  • You could create a custom contenttype or custom list definition and add the ribbontab based on that, or use Javascript to enable/disable the button based on the location (it would be grayed out in the one while active in the other).

     Like you can use :

    EnabledScript="javascript:function oneOrMoreEnable() { 
                 var items = SP.ListOperation.Selection.getSelectedItems(); 
                 var ci = CountDictionary(items); 
                  return (ci > 0); 
                 } 
                 oneOrMoreEnable();" />
    
    To only enable the button when 1 or more items are selected. (just retrieve the url in script and return a true if its the location you want the button enabled)
    • Marked as answer by chrisshizzle2 Friday, August 6, 2010 8:48 AM
    Thursday, August 5, 2010 1:17 PM

All replies

  • You could create a custom contenttype or custom list definition and add the ribbontab based on that, or use Javascript to enable/disable the button based on the location (it would be grayed out in the one while active in the other).

     Like you can use :

    EnabledScript="javascript:function oneOrMoreEnable() { 
                 var items = SP.ListOperation.Selection.getSelectedItems(); 
                 var ci = CountDictionary(items); 
                  return (ci > 0); 
                 } 
                 oneOrMoreEnable();" />
    
    To only enable the button when 1 or more items are selected. (just retrieve the url in script and return a true if its the location you want the button enabled)
    • Marked as answer by chrisshizzle2 Friday, August 6, 2010 8:48 AM
    Thursday, August 5, 2010 1:17 PM
  • hey,

    yes ty, i found that out, too

     

    im using now

     

        RegistrationId="0x01200200F8D32C78FE36EF4FBA2A44B7F81F78F3"
        RegistrationType="ContentType">

     

    to enable my ribbon only for that list

     

    the only problem: if i want that ribbon on an other sharepoint server, i have to change the registrationid manually (do i?)

    but that should be not that big problem...

    Friday, August 6, 2010 8:48 AM
  • Rollout your contenttype with code and you have control over the ID so you wont have to change it on every other server. Otherwise you have to change it everytime you roll it out.
    Friday, August 6, 2010 7:18 PM