1

As we have OOTB "Edit" functionality of SharePoint 2013. I want to assign this functionality to a custom button. How to achieve it.

  • Edit what? Edit page, edit item? – MdMazzotti Jan 22 '14 at 8:52
  • Edit Page functionality – SPDev Jan 22 '14 at 9:06
1

You said you want to trigger the Edit page functionality from a custom button. I think that the code you have to call really depends on the page type (eg. webpartpage vs wiki page).

By following the instruction on this blog post (it refers to SP2010, but I'm reasonably sure the same applies to SP2013 as well), you should be able to find out what javascript command is actually called when you click on a ribbon button.

On a wiki page, the javascript that gets called is:

CoreInvoke('PageActionClick', this);

On a webpartpage, the <a> tag id attribute of the ribbon edit page button reads:

Ribbon.WebPartPage.Edit.Edit.Menu.Actions.Edit

Looking for this string inside the TEMPLATE\GLOBAL\XML\CMDUI.XML file, you'll see that the command actually called is webPartPageStartEdit, which ultimately calls either window.EnsureCheckoutAndChangeLayoutModeToEdit(this.$1.listId, this.$1.itemId, false); or window.ChangeLayoutMode(false, false); depending on whether the force checkout setting is on or off on the pages library where the page being edited resides.

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.