2011-08-24 55 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)。

相關問題