Posts

Applay sort function to the JSon object

function sortByKey(array, key) { return array.sort( function (a, b) { var x = a[key]; var y = b[key]; return ((x < y) ? - 1 : ((x > y) ? 1 : 0 )); }); }

Grep function in jQuerry on date value in between start and end dates of a month

var filteredNews=$.grep(olistData, function (item,index){ return new Date(monthStartDate)<= new Date(item.Created.split( "T" )[ 0 ])&& new Date( item.Created.split( "T" )[ 0 ])<= new Date(monthEndDate); });

Rest API To get Managed metadata Global navigation in sharepoint

/_api/navigation/menustate?mapprovidername=%27GlobalNavigationSwitchableProvider%27

Check wheter it is mobile or a desktop using jquerry

var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)

jQuery - Execute scripts based on screen size

$(window).resize(function () {             if ($(this).width() < '500') {                 alert("mobile");             }             else {                 alert("desktop");             }         });

Using Full Calendar js To apply custom Filters, color coding, Responsive and attaching calendar event to the Mail box

Image
$(document).ready(function () {     bindRecursiveEvents(); }); function bindRecursiveEvents() {     var todayDate = new Date();     var isoDate = todayDate.toISOString();     var viewfiled = "<ViewFields>" +                     "<FieldRef Name='Title' />" +                     "<FieldRef Name='EventDate' />" +                     "<FieldRef Name='EndDate' />" +                     "<FieldRef Name='Location' />" +                     "<FieldRef Name='Description' />" +                     "<FieldRef Name='PublishingPageContent' />" +                   ...

Set user in People picker control in SharePoint using JavaScript

$(document).ready(function() {     var url = "/_api/web/GetUserById(" + _spPageContextInfo.userId + ")/";     var user = "";     getItems(url, function(Users) {         user = Users.d.LoginName.split('|')[1];         if ($("select[title='Status'] option:selected").text() == "Received") {             $("select[title='Status']").val('Pending');             window.setTimeout(function() {                 SetAndResolvePeoplePicker('Document Owner', user);             }, 750);             var d = new Date();             y = d.getFullYear();             m = d.getMonth() + 1;             day = d.getDate();             $("input[title='...