Like in topic.
How to determine in a client web part (on remote web) if a page that the web part is placed on, is in edit mode? if it is possible??
Thanks
Like in topic.
How to determine in a client web part (on remote web) if a page that the web part is placed on, is in edit mode? if it is possible??
Thanks
You can determine if your client web part is in edit mode (when your client web part is being edited).
Unfortunately there is no way to determine if the host web page is being edited. There is a blog post about it at sharapointalist.com
What you have to do is to add an additional token to your client web part:
&editmode=_editMode_
<ClientWebPart Name="ClientWebPart"
Title="TestAppPart"
Description="TestAppPart"
DefaultWidth="600" DefaultHeight="300">
<Content Type="html"
Src="~appWebUrl/Pages/DemoPage.aspx?{StandardTokens}&editmode=_editMode_" />
<Properties>
</Properties>
</ClientWebPart>
Then you have to get this editmode query string, you can do it with getQueryStringParameter function which is "shipped" within the default sharepoint app template in Visual Studio:
function getQueryStringParameter(paramToRetrieve) {
var params =
document.URL.split("?")[1].split("&");
var strParams = "";
for (var i = 0; i < params.length; i = i + 1) {
var singleParam = params[i].split("=");
if (singleParam[0] == paramToRetrieve)
return singleParam[1];
}
}