So I have items for my custom module in my left menu bar, and I know how to order them:
menuitem id="*_id" name="*" parent="*" action="*_act_id" sequence="1"
My question is if it is possible to create sub menus.
Thank you for reading my question.
With kind regards,
To create sub menu you need to define new menu item in your xml file. for example,
This is your existing menu,
<menuitem id="menu_a_id" name="Menu A" parent="Some_parent" sequence="1" />
Now you need to add a another menu item with parent, Here the parent of the sub menu will be the Menu A,
<menuitem id="menu_B_id" name="Menu B" parent="menu_a_id" action="*_act_id" sequence="1" />
It will give you the parent-child(hierarchical) kind of menu item.
Add submenu to an existing menu to other module:
<menuitem id="name_you_want_must_be_unique" name="example"
parent="name_of_module_of_parent_menu.id_parent_menu_"
action="id_action_you_defineinxml_of_your_module" sequence=""/>
Related
I want to add a new button on toolbar of my newly created tab. While I am trying to add a button to my class which is bind to that tab, by default, it goes to the main toolbar at the top instead of on the tab toolbar.
Any suggestion?
By default, all actions will show up in the main toolbar. To hide them, you need to add an entry in the CallbackCommands section of the page. For example, if you look at the customers page, you will find an "Add Contact" button in the Contacts tab. This button is not visible in the main toolbar because of this line in the CallbackCommands section:
<px:PXDSCallbackCommand Name="NewContact" Visible="False" CommitChanges="true" />
Along with above code fix, need to add below under grid also
<CustomItems>
<px:PXToolBarButton Text="New Contact">
<AutoCallBack Command="NewContact" Target="ds" />
</px:PXToolBarButton>
</CustomItems>
I've got a simple split button in my Ribbon. And under it I have two buttons in the menu.
It works well.
Now I want to extend the first button -button id="rxBtn_CreateDataFiles" - into more options,
and have another submenu extend to the right with two more choices.
What would be the syntax for it? Thanks.
<splitButton id="rxspb_CreateDataFiles" size="normal">
<button id="rxBtn_CreateDataFilesFace" label="Data Files" imageMso="ChartEditDataSource"/>
<menu id="rxmnuCreateDataFiles">
<button id="rxBtn_CreateDataFiles" label="Run EQ" onAction="QRCreateDataFiles_Click" imageMso="ExportExcel"/>
<button id="rxBtn_CreateSpecificDataFiles" label="Run Select EQ" onAction="QRCreateDataFilesForSpecific_Click" imageMso="ExportExcel"/>
</menu>
</splitButton >
I figured it out. Just need to insert another menu section in the middle. Thanks.
Here is what I would do: Create the buttons in VBA using Ribbon Commander and then export XML to a static Ribbon using .serializeToXML
With rxCustomUI.defaultInstance
With .ribbon.tabs.Add(New rxTab)
.Label = "tab"
How can I target custom ribbon action menus for specific list views? I want to be displayed in the default view of the list but to be hidden in the other views.
Any ideas?
Though the question is old, yet unanswered , I am responding to it.
Create an empty Sharepoint Project in VS2010 , add an Elements.xml file in the project and past following XML in it.
<CustomAction Id="MyCustomButton" Sequence="999"
GroupId="Manage"
Location="CommandUI.Ribbon" // Location to display button
RegistrationId="101" // on every list, for a specific list or library put the GUID of list here e.g. RegistrationId="{GUID_OF_LIST}"
RegistrationType="List"
Rights="ManageWebs"
Title="Custom Document Library Button">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children">
<Button Id="Ribbon.Documents.Manage.Controls.CustomButton" TemplateAlias="o1"
ToolTipDescription="Creates a server side action."
ToolTipTitle="SSRibbon" LabelText="SS Action"
Image32by32="/_layouts/images/ContractClaims/newproject.jpg"
Image16by16="/_layouts/images/ContractClaims/newproject.jpg" Alt="New Project"
Command="{3E04C0C1-12DD-449E-905F-7E88EB9E22B1}"
Sequence="20"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler Command="{3E04C0C1-12DD-449E-905F-7E88EB9E22B1}"
CommandAction="javascript:alert ('Hello World' ) ;" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
The several locations to display the button can be found here.For more on the top you can google respective XML elements.
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();"
/>
I am having four external list "List1", "List2", "List3", "List4". I have added a custom ribbon button Like:
<?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>
The button is now visible in all the external lists. But I want to make it visible for only "List1" and "List2". How to do this?
You need to explore the Andrew Connell's Ribbon Customization Deep Dive.
http://www.andrewconnell.com/blog/archive/2011/04/16/sharepoint-2010-ribbon-customization-deep-dive.aspx
He goes into how to solve these problems. In short instead of binding a customization for all lists of a certain type, you can register a javascript function that gets called to determine if you button should be shown or hidden. In this function you can determine which list is currently active.
If all your lists are associated with a ContentType, you can set the registration id of the custom action to the ContentType id.
From MSDN:
RegistrationID: Optional Text. Specifies the identifier of the list or
item content type that this action is associated with, or the file
type or programmatic identifier (ProgID).
I was wondering if someone could help me out with Sharepoint 2007. What I want to do is to add a custom menu item to a context menu (the menu that opens when you click a document or another item).
Right now, the menu looks like this:
picture
I want to add an item, "Do stuff" for example, to this menu. Major problems:
I wish this item to appear only in menus for a certain file type (e.g. only for .html but not for .doc);
When I click this item ("Do stuff"), I want to call custom external code (written in C#, either an exe or a DLL), which accepts the name of the clicked file as an input parameter.
I understand the way to achieve this is by using Custom Actions (no javascript editing required in 2007, right?). But since I'm quite new to MOSS, I'm a bit lost and not sure what exactly to do and where to start, so any help is greatly appreciated.
You have to implement a CustomAction like this:
<CustomAction
Id="YourUniqueId"
Location="EditControlBlock"
RegistrationType="FileType"
RegistrationId="html"
Sequence="20"
Title="The text you want">
<UrlAction Url="~site/_layouts/company/ActionPage.aspx?List={ListId}&ID={ItemId}" />
</CustomAction>
What you put in the Url of UrlAction depends on what you want to do. It can be JavaScript or the url of a Page or Handler.
In my example it's a Page which gets the QueryParameters so that SPContext.Current.ListItem will contain the selected documents listitem.
<?xml version="1.0" encoding="utf-8"?>
<Elements Id="d0574a32-59ce-4561-9496-ccf17da37a35" xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="Test2"
Location="EditControlBlock"
RegistrationType="FileType"
//docx = documents, txt = text files, html = html files**
RegistrationId="docx" Sequence="10"
Title="View Item Properties">
<UrlAction Url="~site/_layouts/WSSHOL/ViewPageRedirect.aspx?listid={ListId}&itemid={ItemId}" />
</CustomAction>
</Elements>