title: How to use DataTables server side column ordering?
body: <p>We have a DataTable which contains data like so:</p>
  
  <pre><code>&lt;table class="display" id="invoiceTable"&gt;
      &lt;thead&gt;
          &lt;tr id="headingRow"&gt;
              &lt;th&gt;Sys_InvoiceID&lt;/th&gt;
              &lt;th&gt;Details&lt;/th&gt;
              &lt;th&gt;Inc.In Turnover&lt;/th&gt;
              &lt;th&gt;Status&lt;/th&gt;
              &lt;th&gt;Invoice No.&lt;/th&gt;
              &lt;th&gt;Invoice Date&lt;/th&gt;
              &lt;th&gt;Type&lt;/th&gt;
              &lt;th&gt;Supplier Invoice No.&lt;/th&gt;
              &lt;th&gt;Account Number&lt;/th&gt;
              &lt;th&gt;Supplier&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;1&lt;/td&gt;
              &lt;td&gt;Details1&lt;/td&gt;
              &lt;td&gt;Yes&lt;/td&gt;
              &lt;td&gt;Issue&lt;/td&gt;
              &lt;td&gt;500&lt;/td&gt;
              &lt;td&gt;18/08/2016&lt;/td&gt;
              &lt;td&gt;Type1&lt;/td&gt;
              &lt;td&gt;111111&lt;/td&gt;
              &lt;td&gt;56565&lt;/td&gt;
              &lt;td&gt;SupplierID&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>And the jQuery to initiali<strong>s</strong>e the DataTable looks like this:</p>
  
  <pre><code>$(document).ready(function(){
  var table = $('#invoiceTable').DataTable({
          dom: 'rti',
          ajax: {
              "url": filterDataLink,
          },
          serverSide: true,
          "order": [[5, 'asc']],
          searching: false,
          paging: true,
          scrollX: true,
          scrollY: "75vh", //70% of the window height
          processing: false,
          ordering: true,
          scroller: {
              loadingIndicator: true,
              displayBuffer: 20
          }
      });
  });
  </code></pre>
  
  <p>And the C# method looks like this:</p>
  
  <pre><code>public string FilterData(TableFilterItem tableFilterItem)
  {
      try
      {
          if (tableFilterItem.ColumnOrder == null || tableFilterItem.ColumnOrder.First() == null)
              tableFilterItem.ColumnOrder = new List&lt;ColumnOrder&gt;();
  
  
          SessionModel sessionModel = (SessionModel)Session["Filters"];
          DataTableReturn output = _homeManager.ReturnDataTableSession(sessionModel, tableFilterItem);
          Session["Filters"] = output.SessionModel;
  
          return output.DataTable;
      }
      catch (Exception ex)
      {
          return "An error occurred, please try later! " + ex.Message;
      }
  }
  </code></pre>
  
  <p>TableFilterItem looks like this:</p>
  
  <pre><code>public class TableFilterItem {
      public TableFilterItem() {
  
      }
      public int Start { get; set; }
      public int Length { get; set; }
      public int Draw { get; set; }
  
      public int order { get; set; }
  
  }
  </code></pre>
  
  <p>We also have another AJAX call later in the application which calls the C# method to return data. When clicking on a column it calls the method but I don't know what property to have in the method which would be populated by DataTables so I can access the sorting.</p>
  
  <p>EDIT: It's initialise not initialize. I'm not American.</p>