Server Side - Stuck
Server Side - Stuck
bpeterson76
Posts: 11Questions: 0Answers: 0
All,
Wondering if someone could help. I've been using DataTables quite some time both via dom maniuplation and JSON code. However, two of our larger resultsets are still running too slow, so I'm attempting to convert them over to client-side prospecting.
The following is my code:
AJAX page output (truncated for clarity purposes):
[code]
{"sEcho": "0", "iTotalRecords": "1788", "iTotalDisplayRecords": "1788", "aaData":[["", "", "First", "Last", "company ", "address", "city", "state", ""] ,["", "", "first1", "last1", "company1", "address1", "city1", "state1", "email1"] ]}
[/code]
Jquery Initialization:
[code]
jQuery('#prospectList').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/web/prospect/ajax",
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bAutoWidth": false,
"bFilter":true,
"bLengthChange": true,
"bPaginate": true,
"bSort": true,
"iDisplayLength": 10,
"bInfo": true,
"aoColumns": [
{ "sTitle": "Action" },
{ "sTitle": "First Name" },
{ "sTitle": "Last Name" },
{ "sTitle": "Company" },
{ "sTitle": "Street"},
{ "sTitle": "City" },
{ "sTitle": "State" },
{ "sTitle": "Email" }
]
})
[/code]
Wondering if someone could help. I've been using DataTables quite some time both via dom maniuplation and JSON code. However, two of our larger resultsets are still running too slow, so I'm attempting to convert them over to client-side prospecting.
The following is my code:
AJAX page output (truncated for clarity purposes):
[code]
{"sEcho": "0", "iTotalRecords": "1788", "iTotalDisplayRecords": "1788", "aaData":[["", "", "First", "Last", "company ", "address", "city", "state", ""] ,["", "", "first1", "last1", "company1", "address1", "city1", "state1", "email1"] ]}
[/code]
Jquery Initialization:
[code]
jQuery('#prospectList').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/web/prospect/ajax",
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bAutoWidth": false,
"bFilter":true,
"bLengthChange": true,
"bPaginate": true,
"bSort": true,
"iDisplayLength": 10,
"bInfo": true,
"aoColumns": [
{ "sTitle": "Action" },
{ "sTitle": "First Name" },
{ "sTitle": "Last Name" },
{ "sTitle": "Company" },
{ "sTitle": "Street"},
{ "sTitle": "City" },
{ "sTitle": "State" },
{ "sTitle": "Email" }
]
})
[/code]
This discussion has been closed.
Replies
[code]
{
"sEcho": "0",
"iTotalRecords": "1788",
"iTotalDisplayRecords": "1788",
"aaData": [
//partial json
[/code]
here is what mine looks like:
[code]
{
"sEcho": 1,
"iTotalRecords": 372,
"iTotalDisplayRecords": 372,
"aaData": [
//partial json
[/code]
it appears that your dataTables variable values are in strings, except for aaData.
gutzofter is also correct in that DataTables is expecting numbers for the first three parameters there, rather than strings.
Allan
Is it possible to set it up that if you use sEcho from the server with a value of -1 that dataTables will display it no matter what sequence dataTables is at?
@bpeterson76: The use of sEcho is noted on this page, which details the 'protocol' used for client/server comms: http://datatables.net/usage/server-side . Also in all of the example code, the echo variable is returned as required. Good to hear you got it working in the end :-)
Allan