using datatable scrolly with sharepoint 2013 rest. data is coming but it is taking time
using datatable scrolly with sharepoint 2013 rest. data is coming but it is taking time
Please help on how to use scrolly right.
function LoadProtocolDocuments()
{
var call = $.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/Web/Lists/GetByTitle('current%20studies')/items?$select=BaseName,FileRef,PROTOCOL/Title,SITE/Title,Editor/Name,*&$expand=PROTOCOL,SITE,Editor&$Top=2000",
deferRender: true,
scrollY: 200,
scrollCollapse: true,
scroller: true,
initComplete: function () {
this.api().row( 1000 ).scrollTo();
},
serverSide: true,
responsive: true,
type: "GET",
dataType: "json",
headers: {
Accept: "application/json;odata=verbose"
}
});
call.done(function (data,textStatus, jqXHR){
$('#example').dataTable({
"bDestroy": true,
"bProcessing": true,
deferRender: true,
scrollY: 200,
scrollCollapse: true,
scroller: true,
initComplete: function () {
this.api().row( 1000 ).scrollTo();
},
"aaData": data.d.results,
"aoColumns": [
{ "mData": "BaseName" },
{ "mData": "PROTOCOL" },
{ "mData": "SITE" },
{ "mData": "Modified" },
{ "mData": "Editor" },
{
"targets": 0,
"data": "FileRef",
"render": function (data, type, full, meta) {
return '<a href="' + data + '">View</a>';
}
},
],
fixedColumns: false
});
});
call.fail(function (jqXHR,textStatus,errorThrown){
alert("Error retrieving Tasks: " + jqXHR.responseText);
});
}
// A $( document ).ready() block.
$( document ).ready(function() {
LoadProtocolDocuments();
$(".col-md-4").hide();
});