title: Server side pagination is not rendering the table data
body: <p>I am trying to do pagination from the server side. My project tech stack is MongoDB + Spring + Angular + Angular-datatables.</p>
  
  <p>MongoDB provides very simple method to retrieve the data according to pagination and sorting parameters</p>
  
  <p>URL to fetch the data is pasted here which is a 'POST' request and also would like to send the few other parameters with request body</p>
  
  <pre><code> /myapp/products/filter?pageSize=10&amp;pageNo=1
  </code></pre>
  
  <p>After some googling and going through the jQuery DataTables manual, I found out how to make this in <a href="https://github.com/l-lin/angular-datatables" rel="nofollow">angular-datatables</a>. Pasted the code below:</p>
  
  <pre><code>     vm.dtOptions = DTOptionsBuilder.newOptions().withOption('ajax', {
              url : '/myapp-api/products/filter',
              type : 'POST',
              contentType : 'application/json',
              dataType :'json',
              accepts: "application/json",
              headers: {
                  Accept: "application/json",
                  Authorization : 'Bearer eyJ0eXAiO.eyJpZCI6IjU1OhSbNTdmIoq1Y'
              },
              data:function(d){
                       var pageNo = d.start;
                   var pageSize = d.length;
                       return JSON.stringify( d );
              },
              success:function(response){
                  console.log(" ajax &gt; post &gt; success &gt; response &gt; ", response);
                  var page = {
                      "draw":1,
                      "data" : response.list,
                      "recordsTotal" :response.list.length,
                      "recordsFiltered" :response.list.length
                  };
                  return page;
              }
          })
          .withDataProp('data')
          .withOption('processing', true)
          .withOption('serverSide', true)
          .withPaginationType('full_numbers');
  </code></pre>
  
  <p>I am able to receive the response successfully but the datatable is not displaying the data. In the success function callback, returning the data as per the format which is mentioned in datatables web pages. </p>
  
  <p>Along side, I have few more queries:</p>
  
  <ol>
  <li><p>Can I use <code>$http.post</code> method to retrieve the data from the server, I understand that datatables has some mechanism which is calling the ajax on each action done in the datatables. </p></li>
  <li><p>The <code>data: function(){}</code> gives me the entire datatable column and other details in object format, used <code>JSON.Stringify(data)</code> as workaround.  </p></li>
  </ol>
  
  <p>My server side implementation expects the JSON data and I need only few parameters out of it.</p>
  
  <p>Has anyone here has done the implementation using <code>$http.post</code> method. when I tried it, It was giving me the error:</p>
  
  <blockquote>
    <p>TypeError: Cannot read property 'aDataSort' of undefined</p>
  </blockquote>
  
  <pre><code>    $scope.dtOptions = DTOptionsBuilder.newOptions()
       .withOption('ajax', function(data, fnCallback, settings) {
              $http.post('/myapp/products/filter?pageNo=1&amp;pageSize=10', {}).then(function(response) {
                    fnCallback(response);
       });      
      })
      .withDataProp('list')
      .withOption('processing', true)
      .withOption('serverSide', true)
      .withPaginationType('full_numbers');
  </code></pre>