This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function CSOMOperations(columnData,listName,action,itemID){ | |
| var context = SP.ClientContext.get_current(); | |
| var web = context.get_web(); | |
| var list = web.get_lists(); | |
| var targetList = list.getByTitle(listName); | |
| var item; | |
| switch(action){ | |
| case 'create': | |
| var listItemCreation = new SP.ListItemCreationInformation(); | |
| item = targetList.addItem(listItemCreation); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function stackBootstrapModal(){ | |
| $(document).on('show.bs.modal', '.modal', function (event) { | |
| var zIndex = 1040 + (10 * $('.modal:visible').length); | |
| $(this).css('z-index', zIndex); | |
| setTimeout(function() { | |
| $('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack'); | |
| }, 0); | |
| }); | |
| $(document).on('hidden.bs.modal', '.modal', function () { | |
| $('.modal:visible').length && $(document.body).addClass('modal-open'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Render and initialize the client-side People Picker. | |
| function initializePeoplePicker(peoplePickerElementId) { | |
| // Create a schema to store picker properties, and set the properties. | |
| var schema = {}; | |
| schema['PrincipalAccountType'] = 'User,DL,SecGroup,SPGroup'; | |
| schema['SearchPrincipalSource'] = 15; | |
| schema['ResolvePrincipalSource'] = 15; | |
| schema['AllowMultipleValues'] = true; | |
| schema['MaximumEntitySuggestions'] = 50; | |
| schema['Width'] = '280px'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getUserInfo(alias){ | |
| $.ajax({ | |
| url: "/sites/_api/sp.userprofiles.peoplemanager/GetPropertiesFor(@v)?@v='"+encodeURIComponent('i:0#.f|membership|'+alias)+"'", | |
| type: "GET", | |
| headers: { "Accept": "application/json;odata=verbose" }, | |
| success: function(data) { | |
| var dataResults = data.d; | |
| debugger; | |
| }, | |
| error: function (err) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Do this on $(document).ready(function() { ... }) | |
| var divClone = $("#some_div").clone(); | |
| // Change the content temporarily | |
| $("#some_div").html("Yeah all good mate!"); | |
| // Use this command if you want to keep divClone as a copy of "#some_div" | |
| // Restore element with a copy of divClone | |
| $("#some_div").replaceWith(divClone.clone()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=your page token here" %> | |
| <asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"> | |
| <fieldset> | |
| <div class="form-group"> | |
| <label class="col-md-4 control-label" for="textinput">Owner</label> | |
| <div class="col-lg-7"> | |
| <div class="input-group"> | |
| <SharePoint:ClientPeoplePicker | |
| Required="true" | |
| AllowEmailAddresses="true" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var userProfileProperties = []; | |
| function getUserProperties() | |
| { | |
| // Replace the placeholder value with the target user's credentials. | |
| var targetUser = '[email protected]'; | |
| // Get the current client context and PeopleManager instance. | |
| var clientContext = new SP.ClientContext.get_current(); | |
| var peopleManager = new SP.UserProfiles.PeopleManager(clientContext); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function createItemCSOM(listName){ | |
| var context = SP.ClientContext.get_current(); //gets the current context | |
| var web = context.get_web(); | |
| var list = web.get_lists(); | |
| var targetList = list.getByTitle(listName); | |
| var listItemCreation = new SP.ListItemCreationInformation(); | |
| var newItem = targetList.addItem(listItemCreation); | |
| newItem.set_item("owner",SP.FieldUserValue.fromUser('[email protected]')); | |
| newItem.update(); | |
| context.load(newItem); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Re-Intialize datatable | |
| var myTable = $('#result').DataTable({"destroy": true}); | |
| //Before Adding Data [if you dont want new data append to exisinting data] | |
| myTable.clear(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*For browser which doesn't support HTML5*/ | |
| function placeHolderPolyFill(){ | |
| $("input[placeholder]").each(function () { | |
| var $this = $(this); | |
| if($this.val() == ""){ | |
| $this.val($this.attr("placeholder")).focus(function(){ | |
| if($this.val() == $this.attr("placeholder")) { | |
| $this.val(""); | |
| } | |
| }).blur(function(){ |