Contents
I have created a list of sample data for our project, Sample Data Source: jQuery DataTable Official Site, You can also use import spreadsheet SharePoint App to import bulk data from excel spreadsheet Now we will create the script file and the html Site page for displaying the list data. JS file to get the data from SharePoint list.
How to get all SharePoint list items using REST API?
If you are familiar with the script editor web part, then you can add a script editor web part in the SharePoint web part page. Then add the below code in the script editor web part.
JS file to get the data from SharePoint list. Go to Data Table CDN to get the required JS and CSS files. dataTables.jqueryui.min.css
How to bind data to DataTable in jQuery?
Now we will bind the data obtained from the API Call with the jQuery DataTable [HTML View]. mySuccessHandler function binds the data to the DataTable. Copy both the files [html and JavaScript] to SharePoint SiteAssets Library. Create a Webpart Page (Named DataTable) and store it in the pages or the site pages library.
How are DataTables used in a jQuery customization?
Finally, the customization uses DataTables to load and present the list of IT support requests. The data is loaded by using AJAX from a SharePoint list. Thanks to using DataTables, end users get a powerful solution where they can easily filter, sort, and page through the results without any additional development effort.
How to migrate jQuery and DataTables to SharePoint framework?
To illustrate the process of migrating a SharePoint customization using DataTables to the SharePoint Framework, use the following solution that shows an overview of IT support requests retrieved from a SharePoint list. The solution is built by using the standard SharePoint Script Editor web part. Following is the code used by the customization.
Create a Sharepoint List with data, this is the list from which we will retrieve the data and pass the data to jQuery DataTable. S kip this step if you already have the Data Source List on your SharePoint Site.
How to create SharePoint items from data table?
We’ll need to add SharePoint – Create Item, select our Orders list and fill in all the columns with Form fields, like this: To make Title unique I’ve added Date Needed to it, with formatting: