Posts

Showing posts from May, 2021

Clear DataTable on button click

Image
How to clear DataTable on button click In this post we will learn how we can clear a datatable on a jQuery event. By click on "btnReset" we have to call datatable's destroy method to completely clear a datatable. We may need to clear a datatable on an event. Please follow the below code to achieve the same. HTML - <table id="tblResourcesData" class="display" width="100%" cellspacing="0">           <thead>               <tr>                   <th>Title</th>                   <th>Region</th>                 <th>Country</th>                <th>Email</th>             </tr>           </thead>  </table> Code - $("#btnReset").click(function(){                     $('#tblResourcesData').DataTable().destroy();                        $('#tblResourcesData tbody').empty(); });  

Get more than 5000 list items in SharePoint using Deferred Promises jQuery

Image
How to more than 5000 list items in SharePoint using Deferred Promises jQuery In the below post you will learn how we can get more than 5000 list items using REST api. As we know that in SharePoint, number of items we can fetch at one time which should not be more than 5000 items that default architect of SharePoint list says. But in some of  the requirements we may need to get more than 5000 list items. When we Query large list by rest "/_api/web/lists/getbytitle ('<list title>')/items" on the list which has more than 5000 items, we get following exception "Request failed. The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator". So to resolve the above error you will learn to how code to get more than 5000 records. Code -  var TotalCAPItemCount = 0; $(window).load(function() {         var ItemCount = GetItemCount('CAP');          createRestUrl(ItemCount,'CAP');    }); //Step 1. ge

Upload multiple attachments to SharePoint List Item using REST API jQuery, along with People Picker Column

Image
How to Upload multiple attachments to SharePoint List Item using REST API jQuery, along with People Picker Column In this post I will show you how we can upload multiple attachments on a SharePoint List item, I am taking a People Picker field here where you can store multiple SharePoint users along with other columns. Please refer the below code, It would be very helpful for you to implement the same in your projects. In the below code you will find how you can clear a input type file and people picker field.  JS Files need to be used -   <!-- SharePoint Specific Javascript Start -->       <!--script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script-->         <script type="text/javascript" src="/_layouts/15/sp.js"></script>         <script type="text/javascript" src="/_layouts/15/1033/strings.js"></script>         <script type="text/javascript" src="/_