2011-08-24 54 views
1

我有四个外部列表“List1”,“List2”,“List3”,“List4”。我添加了一个自定义功能区按钮像:在SharePoint中如何仅将自定义功能区按钮显示到特定列表?

<?xml version="1.0" encoding="utf-8"?> 
<Elements xmlns="http://schemas.microsoft.com/sharepoint/"> 
    <CustomAction 
    Id="ATEAgWorkOrderButton" 
    RegistrationType="List" 
    RegistrationId="600" 
    Location="CommandUI.Ribbon"> 
    <CommandUIExtension> 
     <CommandUIDefinitions> 
     <CommandUIDefinition 
     Location="Ribbon.ListItem.Actions.Controls._children"> 
      <Button 
      Id="Ribbon.ListItem.Actions.ATEAgWorkOrderButton" 
      Alt="Click on this button to Add" 
      Sequence="3" 
      Image32by32="/_layouts/Images/Project/image.png" 
      Command="ATEAg_WorkOrder" 
      LabelText="Add Detail" 
      TemplateAlias="o2"/> 
     </CommandUIDefinition> 
     </CommandUIDefinitions> 
     <CommandUIHandlers> 
     <CommandUIHandler 
     Command="ATEAg_WorkOrder" 
     CommandAction="javascript:alert("Hello Success");" /> 
     </CommandUIHandlers> 
    </CommandUIExtension> 
    </CustomAction> 
</Elements> 

该按钮现在可以在所有外部列表中看到。但是我想让它只显示“List1”和“List2”。如何做到这一点?任何人都可以帮忙吗?

回答

2

您需要探索Andrew Connell的Ribbon Customization Deep Dive。

http://www.andrewconnell.com/blog/archive/2011/04/16/sharepoint-2010-ribbon-customization-deep-dive.aspx

他走进如何解决这些问题。简而言之,不是绑定某个类型的所有列表的自定义,您可以注册一个javascript函数,该函数被调用以确定您的按钮是否应该显示或隐藏。在此功能中,您可以确定哪个列表当前处于活动状态。

+0

谢谢@Mark。 – ANP

0

如果您的所有列表都与ContentType关联,则可以将自定义操作的注册标识设置为ContentType标识。

MSDN

RegistrationID:可选文本。指定与此操作关联的列表或 项目内容类型的标识符,或文件类型或编程标识符(ProgID)。

相关问题