Posts

Showing posts from May, 2020

How to customize Data Tables

Image
Customizing Data Tables -  In the below scenario i have changed data table button names, customize paginate, customize search, customize infoFiltered etc. You just need to get your data from a data source and apply the below code. Code -  $("#tbl").DataTable({         dom: 'Bfrtip',         buttons: [{           extend: 'pdf',           text: 'Pdf'         }, {           extend: 'excel',           text: 'Excel'         }],         language: {           paginate: {             next: '→', // or '→'             previous: '←' // or '←'            },           search: '🔎',           info...

How to get the values of selected check boxes in a collection using jQuery

Image
Get the values of selected check boxes using jQuery In the below scenario we have used jQuery each loop and join function, with the help of these we can get selected values of check boxes. HTML -          <h3>Select your favorite sports:</h3>         <label><input type="checkbox" value="football" name="sport"> Football</label>         <label><input type="checkbox" value="baseball" name="sport"> Baseball</label>         <label><input type="checkbox" value="cricket" name="sport"> Cricket</label>         <label><input type="checkbox" value="boxing" name="sport"> Boxing</label>         <label><input type="checkbox" value="racing" name="sport"> Racing</label>         <label><input type="checkbox" value="swimming" n...

How to Change Formatting of SharePoint List's Date Type Column using javascript

Image
Change Formatting of SharePoint List's Date Type Column using javascript SharePoint list's date type column gives us date in the below format :- 2020-04-02T20:17:46.384Z You can modify this format according to your need, below is an explanation of this -  $.each(data.d.results, function(key, value) {                    var d = value.Created.substring(0, value.Created.lastIndexOf("T"));           var year = d.split("-")[0];           var month = d.split("-")[1];               var day = d.split("-")[2];             alert(day +"-"+ month +"-"+ year);                                   }         });  Output Date format would be :-  02-04-2020

How to send Email using REST Api

Image
Send Email using REST Api Sometimes we need to use Rest api for sending emails as we have its utility - " /_api/SP.Utilities.Utility.SendEmail" which is responsible for this feature. You can pass parameters in the below functions such as Subject, To, CC and body. For sending multiple users we need to defined  to,cc as array collection. Code -  function SendEMail(subject,to,cc,body){         $.ajax({             contentType: 'application/json',             url: _spPageContextInfo.webAbsoluteUrl + "/_api/SP.Utilities.Utility.SendEmail",             type: "POST",             data: JSON.stringify({                 'properties': {                     '__metadata': {                         't...