1. First of all, let me show you the ribbon modal in our project whcih just like the example from internet.
>>SPMIPRibbon.cs
I‘ve add some clear comments.
>>SPMIPRibbon.js
Ribbon command javascript file
Now let us see how to use it
Declare a ribbon definition like this as below
Override OnPreRender method and add the following code
Enjoy it.
Here is one problem when we migrate it from SP14 to SP15, we may get error message as "getGlobalCommands not found".
The reason is in SharePoint 2013, the SPRibbonScriptManager class‘s execution is slower than the js execution, when the js object initializes, the needed commands have not generated.
To solve this, we need to do a little change to the js file.
Change the
to
That is all, thanks.