title: DataTable sorting via server side rendering
body: <p>I want to sort my datatable via server side. 
  When i click the column i want to sort, then i arrive in backend with the requested parameters, sort my result and return them to client. But in javascript the datatable does not refresh the sorting data.</p>
  
  <p>The default sorting is by first table column ascending. Which you can see at the end of javascript code.</p>
  
  <p>In javascript code you can see the ajax area. In this area arrive, when i click on each column of the table i want to sort. But the data don't refresh, it only shows the processing label.
  In the developer area of browser, i get the correct sorting data.</p>
  
  <p>Here my javascript code:</p>
  
  <pre><code>    workListTable = $('#worklist-table').DataTable({
                  searching: false,
                  paging: false,
                  info: false,
                  processing: true,
                  serverSide: true,
                  ordering: true,
                  scrollX: true,
                  scrollY: "55vh",
                  ajax: 
                  {
                      url: "search.do",
                      type: "POST",
                      data: function(d)
                      {
                          d.todo = "loadListData";
                          var filterArray = [];
  
                          filterArray.push({machineGroup: machineId});
                          filterArray.push({itemNumber: itemNumber.val()});
                          filterArray.push({projectNumber: projectNumber.val()});
                          filterArray.push({sbaFrom: sbaFrom.val()});
                          filterArray.push({sbaTo: sbaTo.val()});
                          filterArray.push({userId: userId.val()});
  
                          var orderBy = "asc";
                          var orderColumnName = "";
                          for (var i = 0; i &lt; d.columns.length; i++)
                          {
                              for (var j = 0; j &lt; d.order.length; j++)
                              {
                                  var orderColumn = d.order[j].column;
                                  if (i == orderColumn)
                                  {
                                      orderColumnName = d.columns[i].name;
                                      orderBy = d.order[j].dir;
                                      break;
                                  }
                              }
                          }
  
                          var orderByObject = 
                          {
                              orderColumn: orderColumnName,
                              orderColumnBy: orderBy
                          };
  
                          return $.extend({}, d, {
                              "filter": filterArray,
                              "order": orderByObject
                          });
                      },
                  },
                  columns: [/*print column data*/],
  initComplete: function( settings, json )
                  {
                      $(buttonSearch).removeClass('disabled');
                  },
                  order: [[0, "desc"]]
  </code></pre>
  
  <p>And the javacode:</p>
  
  <pre><code> @PostMapping("/search.do")
      public ResponseEntity&lt;Object&gt; search()
      {
          ResponseEntity&lt;Object&gt; response = new ResponseEntity&lt;Object&gt;(null, HttpStatus.NOT_FOUND);
          try
          {
              // get the filter parameter
              final WorkListModel model = getFilterParameters(getRequest().getParameterMap());
              List&lt;WorkList&gt; list = workListService.getWorkList(model);
              if (!CollectionUtils.isNullOrEmpty(list))
                  list = sortList(list, getRequest().getParameterMap());
  
              final WorkListDataObject dataTableObject = new WorkListDataObject();
              dataTableObject.setData(list);
              dataTableObject.setDraw(1);
              dataTableObject.setRecordsFiltered(list.size());
              dataTableObject.setRecordsTotal(list.size());
  
              response = new ResponseEntity&lt;Object&gt;(dataTableObject, HttpStatus.OK);
          }
          catch (Exception e)
          {
              LOG.error("WorkListController.search(): Error while worklist lines.", e);
              response = new ResponseEntity&lt;Object&gt;(message, HttpStatus.INTERNAL_SERVER_ERROR);
          }
          return response;
      }
  </code></pre>