mardi 24 février 2015

Enable/Disable Button On Ribbon When Content Type Selected



I have created a custom action button that appears on the DisplayForm for a specific content type.


On the list view I would also like to enable the button but only when the specific content type is selected and only if there is only one item selected.



<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://ift.tt/sQmbje">
<CustomAction
Description="Button Blah"
Title="Button Title"
Id="{53801DF2-A778-4E93-8191-ACBC06C7D4DD}"
Location="???????????????"
RegistrationType="ContentType"
RegistrationId="0x010014D754C688D12A4FB4C811B4B4F67A5C"
Sequence="0"
Rights="ViewListItems"
xmlns="http://ift.tt/sQmbje">
<CommandUIExtension xmlns="http://ift.tt/sQmbje">
<!-- Define the (UI) button to be used for this custom action -->
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.ListForm.Display.Manage.Controls._children">
<Button Id="{10C2173C-537F-4D3D-8394-9ADB8486CEBE}"
Command="{99AAAD72-4AB6-4EC0-8B5A-E3F194145A4D}"
Image32by32="~site/_layouts/Images/GCMS/SomeImage32.png"
Image16by16="~site/_layouts/Images/GCMS/SomeImage16.png"
Sequence="0"
LabelText="Button Label Text"
Description="Button Blah"
TemplateAlias="o1" />
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<!-- Define the action expected on the button click -->
<CommandUIHandler Command="{99AAAD72-4AB6-4EC0-8B5A-E3F194145A4D}" CommandAction="~site/_layouts/custompage.aspx?List={ListId}&amp;ID={ItemId}" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>


How do I show/hide a button when a specific content type is selected in a list view?








0 commentaires:

Enregistrer un commentaire