Datatable Not loading more than 300 items json call
Datatable Not loading more than 300 items json call
nidhincee@gmail.com
Posts: 2Questions: 1Answers: 0
Hi All,
I am using datatable.net for loading data in sharepoint webpart. But it is not loading more than 300 items .
_
Javascript function_
function ReloadTable() {
var from = jqhdr('#txtDateFrom').val();
var to = jqhdr('#txtDateTo').val();
var reqType = jqhdr('#DropDownList1').val();
if (reqType == "1") reqType = "Issue";
else if (reqType == "2") reqType = "Service"; else reqType = "All";
var rpthd = "(" + reqType + ") ";
if(from !="" && to !="")
rpthd += " from " + from + " to " + to ;
jqhdr.ajax({
url: "/_layouts/15/Pages/WebMethods.aspx/RequestDetails",
type: "POST",
dataType: "json",
data: JSON.stringify({ 'siteUrl': siteUrlHelpDeskReport, 'listName': listHelpDeskReport, 'dateFrom': jqhdr('#txtDateFrom').val(), 'dateTo': jqhdr('#txtDateTo').val(), 'reqType': jqhdr('#DropDownList1').val() }),
contentType: "application/json; charset=utf-8",
async: false,
success: function (json) {
var dataSet = JSON.parse(json.d).data;
var table= jqhdr('#extable').DataTable({
destroy: true,
data: dataSet,
dom: 'Bfrtip',
buttons: [
{
extend: 'copyHtml5',
footer: 'true',
text: 'copy',
title: 'Request Report' + rpthd,
exportOptions: {
columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,13,14]
}
},
{
extend: 'csvHtml5',
footer: 'true',
text: 'csv',
title: 'Report' + rpthd,
exportOptions: {
columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
}
},
{
extend: 'excelHtml5',
footer: 'true',
text: 'Excel',
title: 'Report' + rpthd,
exportOptions: {
columns: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
}
},
{
extend: 'pdf',
footer: 'true',
text: 'pdf',
orientation: 'landscape',
pageSize: 'LEGAL',
title: 'Report' + rpthd,
exportOptions: {
columns: [ 1, 2, 3,4,5,6,7,8,9,10,11,12]
}
},
],
deferRender: false,
"columns": [
{
"data": "ID", "title": "ID", "visible": false
},
{
"data": "RequestNo", "title": "Request No", "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
jqhdr(nTd).html("<a href='http://"+window.location.host+"/EN/HelpDesk/Lists/Service%20Requests/DispForm.aspx?ID=" + oData.ID + "'>" + oData.RequestNo + "</a>");
}
},
{ "data": "RequestedBy", "title": "Requested By" },
{ "data": "Title", "title": "Title" },
{ "data": "AssignedTo", "title": "Assigned To" },
{ "data": "RequestedService", "title": "Requested Service" },
{ "data": "RequestStatus", "title": "Request Status" },
{ "data": "RequestDate", "title": "Request Date" },
{ "data": "KPI", "title": "KPI" },
{ "data": "StartDate", "title": "Start Date" },
{ "data": "ExpectedEndDate", "title": "Expected End Date" },
{ "data": "EndDate", "title": "End Date" },
{ "data": "Conformity", "title": "Conformity" },
{ "data": "TCDays", "title": "TCDays" },
{ "data": "Solution", "title": "Solution" }
]
});
// // Filter event handler
//jqhdr(table.table().container()).on('keyup', 'tfoot input', function () {
// table
// .column(jqhdr(this).data('index'))
// .search(this.value)
// .draw();
//});
}
});
}
Please help me . I am new in datatable.net
This discussion has been closed.
Answers
.net code
public static string RequestDetails(string siteUrl, string listName, string dateFrom, string dateTo, string reqType)
{
try
{
DataTable servReqsts = DALHelper.GetDataTable(siteUrl, listName, "", 0, false, false, false, string.Empty, false);
List<BACAServiceRequests> lstserviceReq = new List<BACAServiceRequests>();
WebMethods webMethods = new WebMethods();
lstserviceReq = webMethods.ConvertDataTable<BACAServiceRequests>(servReqsts).ToList().OrderByDescending(s => s.ID).ToList();
Hi @nidhincee@gmail.com ,
That's a lot of code here. Are you getting any errors on the DataTables end? Is it the backend not create the 300 rows? Have you debugged to see where the problems could lie? What have you tried to far?
Cheers,
Colin