Paging not working with Ajax datasource.
Paging not working with Ajax datasource.
tpizzo
Posts: 2Questions: 0Answers: 0
I am using the datatables jquery plug in version 1.8.1. I have a table with and ajax data source. If I get back for example 20 results and the drop down on the table is set to 10 it still shows all 20 results in the table. If I try changing the drop down selection no change occurs. Below is my JavaScript for creating a data table and the json I am getting back from the web service. The json only has two results to make it easier to read. I also have an alias for jquery hence the $j rather than just $. Can you tell me what I'm doing wrong. Thank you.
Javascript:
$j(document).ready(function () {
CheckListExplorer.ChecklistTable = $j('#ChecklistExplorerTable').dataTable({
"sDom": '<"H"lfr>t<"F"ip>',
"bProcessing": true,
"bServerSide": true,
"bAutoWidth": false,
"sAjaxSource": 'http://localhost/iportal/DesktopModules/ASI.IDoc/BaseControls/Handlers/ChecklistExplorerHandler.ashx',
"aoColumns": [{ "sTitle": "Documents" }, { "sTitle": "ID" }, { "sTitle": "Checklist Name" }, { "sTitle": "Checklist Type" }, { "sTitle": "Account Number" }, { "sTitle": "Account Type"}],
"bJQueryUI": true
}).fnSetFilteringDelay(1500);
});
JSON returned from web service.
{"sEcho":"1","iTotalRecords":2,"iTotalDisplayRecords":"10","iDisplayLength":"10","aaData":[["\u003ca href=\u0027#\u0027 id=\u00274\u0027\u003eDocuments\u003c/a\u003e","4","John C. Customer Home Loan","Auto Converted","",""],["\u003ca href=\u0027#\u0027 id=\u00275\u0027\u003eDocuments\u003c/a\u003e","5","John C. Customer Car Loan","Loan","",""]]}
Javascript:
$j(document).ready(function () {
CheckListExplorer.ChecklistTable = $j('#ChecklistExplorerTable').dataTable({
"sDom": '<"H"lfr>t<"F"ip>',
"bProcessing": true,
"bServerSide": true,
"bAutoWidth": false,
"sAjaxSource": 'http://localhost/iportal/DesktopModules/ASI.IDoc/BaseControls/Handlers/ChecklistExplorerHandler.ashx',
"aoColumns": [{ "sTitle": "Documents" }, { "sTitle": "ID" }, { "sTitle": "Checklist Name" }, { "sTitle": "Checklist Type" }, { "sTitle": "Account Number" }, { "sTitle": "Account Type"}],
"bJQueryUI": true
}).fnSetFilteringDelay(1500);
});
JSON returned from web service.
{"sEcho":"1","iTotalRecords":2,"iTotalDisplayRecords":"10","iDisplayLength":"10","aaData":[["\u003ca href=\u0027#\u0027 id=\u00274\u0027\u003eDocuments\u003c/a\u003e","4","John C. Customer Home Loan","Auto Converted","",""],["\u003ca href=\u0027#\u0027 id=\u00275\u0027\u003eDocuments\u003c/a\u003e","5","John C. Customer Car Loan","Loan","",""]]}
This discussion has been closed.
Replies
http://datatables.net/usage/server-side
What I am looking for is :
datatable with ajax only pagination, but not for search and sorting.
search and sorting I want as js.
Is it possible ?
Please help me out.
Thank you very much
Allan