0

I'm using the Easy Ribbon API to show Ribbons in Edit/Disp form. When I only use one GroupDefinition everything works like a charm, but as soon as I want to add a second group of ribbons, the first one disappears and only the second one is shown.

        //Code sample first group
        var ribbonCustomAction = new RibbonCustomAction();
        var notificationButtonDefinition = new ButtonDefinition()
        {
            Id = "Doc_erzeugen",
            Title = "Dokument erzeugen",
            CommandJavaScript = "createDocument();",
            Image = ImageLibrary.GetStandardImage(2, 1, web.CurrencyLocaleID)
        };
        var actionGroupDefinition2 = new GroupDefinition()
        {
            Id = "Process_Actions",
            Title = "Dokument Aktionen",
            Template = GroupTemplateLibrary.SimpleTemplate,
            Controls = new ControlDefinition[]
            {
                notificationButtonDefinition
            }
        };
        ribbonCustomAction.AddControlGroup(actionGroupDefinition2, SPRibbonIds.ListForm_Display.Id, 3005);
        ribbonCustomAction.AddControlGroup(actionGroupDefinition2, SPRibbonIds.ListForm_Edit.Id, 3005);
        ribbonCustomAction.Provision(ReceiverGuid, list); 

If I use this code only, it shows the expected ribbons.

RibbonBar1

        //Code sample second group
        var ribbonCustomAction = new RibbonCustomAction();
        var notificationButtonDefinition = new ButtonDefinition()
        {
            Id = "Doc_erzeugen",
            Title = "Dokument erzeugen",
            CommandJavaScript = "createDocument();",
            Image = ImageLibrary.GetStandardImage(2, 1, web.CurrencyLocaleID)
        };

                    var actionGroupDefinition2 = new GroupDefinition()
        {
            Id = "Process_Actions",
            Title = "Vorgang Aktionen",
            Template = GroupTemplateLibrary.SimpleTemplate,
            Controls = new ControlDefinition[]
            {
                createAppointmentButtonDefinition
            }
        };
        ribbonCustomAction.AddControlGroup(actionGroupDefinition2, SPRibbonIds.ListForm_Display.Id, 3002);
        ribbonCustomAction.AddControlGroup(actionGroupDefinition2, SPRibbonIds.ListForm_Edit.Id, 3002);
        ribbonCustomAction.Provision(ReceiverGuid, ToolkitUtility.FindListByName(web, "Vorgänge"));

But after adding this code, all I get is this.

RibbonBar2

Also the Ribbons are shown in the NewForm which they shouldn't...

0

Found my mistake...

The sequence (AddControlGroup([..], [..], Sequence))has to be the same value in each form. So for my example that'd be:

   ribbonCustomAction.AddControlGroup(actionGroupDefinition1, SPRibbonIds.ListForm_Display.Id, 3002);
   ribbonCustomAction.AddControlGroup(actionGroupDefinition1, SPRibbonIds.ListForm_Edit.Id, 3003);

    ribbonCustomAction.AddControlGroup(actionGroupDefinition2, SPRibbonIds.ListForm_Display.Id, 3002);
    ribbonCustomAction.AddControlGroup(actionGroupDefinition2, SPRibbonIds.ListForm_Edit.Id, 3003);

The new form "problem" was solved by hiding via JQuerys .hide()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.