Add properties to xhr object, although this is not the preferred approach. 2. Wrap in a function as in: Xhttp.onreadystatechange = function(){callback(x,g);};
Notes, great finds, and more about SharePoint solutions, JavaScript, React, and more.
Add properties to xhr object, although this is not the preferred approach. 2. Wrap in a function as in: Xhttp.onreadystatechange = function(){callback(x,g);};
Style guides from John Papa Angular Style Guide: A starting point for Angular development teams to provide consistency through good practices. https://github.com/johnpapa/angular-styleguide Style guide for Angular 2 https://angular.io/docs/ts/latest/guide/style-guide.html
Useful snippet for SharePoint forms for binding various event handlers to the Submit button. var handlerArray = Array[]; function RegisterButtonClickHandlers(handlerArray) for (var x = 0; x < handlerArray.length; x++) { var handler = handlerArray[x]; submitButton.addEventListener("click", handler): } }
Adding JavaScript to a sandboxed Visual Web Part seems to work best when using the following script inside the .ascx file: <script type="text/javascript"> SP.SOD.executeFunc("~sitecollection/_catalogs/siteassets/MyWebPart/MyWebPartScript.js", null, LoadMyScript); //the following two variables keep the page with the web part from freezing and becoming uneditable when in edit mode var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value; var wikiInEditMode = document.forms[MSOWebPartPageFormName]._wikiPageMode.value; if […]
Having trouble getting JavaScript files to run in your SharePoint site? Make sure you set the LoadAfterUI=”true” attribute in your ScriptLink tag. Here is an example: <SharePoint:ScriptLink ID=”MyBaseID” Name=”~Site/_catalogs/masterpage/MyPathtoJavascriptFile/mycustomjavascriptfile.js” runat=”server” OnDemand=”false” LoadAfterUI=”true” Localizable=”false”/>