title: GSON with DataTables spring mvc for empty data
body: <p>I am using the <code>sAjaxSource</code> for fetching data from my spring controller which gives a json response.
  Something like this</p>
  
  <pre><code>   [
     {
        "id":20009,
        "title":"1914 tran by H. Rackham",
        "description":"\"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charmces ",
        "username":"nessudi",
        "datecreated":"Apr 22, 2014 10:39:24 AM"
     },
     {
        "id":20008,
        "title":"The standard Lorem Ipsum passage, used since the 1500s",
        "description":"\"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"",
        "username":"naai",
        "datecreated":"Apr 22, 2014 10:38:46 AM"
     },
     {
        "id":20065,
        "title":"Where to get Lorem Ipsum",
        "description":"Therpetition, injected humour, or non-characteristic words etc.",
        "username":"nensi",
        "datecreated":"Apr 22, 2014 10:37:34 AM"
     },
     {
        "id":20056,
        "title":"What is Lorem Ipsum",
        "description":"Lorrinter took a galley of type and scrambled it to make a type specimen book. ",
        "username":"xyz",
        "datecreated":"Apr 22, 2014 10:28:39 AM"
     }
  ]
  </code></pre>
  
  <p>Although when there is no data the datatable show "Loading......" message.</p>
  
  <p>I read through other posts which suggested to send empty array with "{aaData:[ ]}"..but I am using 
  "sAjaxDataProp": "" ..so my data property is null.. How do i handle this? I am using the gson library in java.</p>
  
  <p>This is my controller</p>
  
  <pre><code>@RequestMapping(value="/theurl", method =  RequestMethod.GET)
      public @ResponseBody String somemethod(){
          List&lt;someobject&gt; listobjs = this.someService.getobjsList();
          if(listobjs != null){
              Collections.sort(listobjs, Collections.reverseOrder());
          }
          return gson.toJson(listobjs);
      }
  </code></pre>
  
  <p>Here is my Datatable creation</p>
  
  <pre><code>$("#myTable").dataTable({
              "bPaginate": true,
              "sAjaxSource": "/theurl",
              "sAjaxDataProp": "",
              "oLanguage": {
                  "sEmptyTable":     "My Custom Message On Empty Table"
              },
              "iDisplayLength": 5,
              "bSort" : false,
              "aoColumnDefs" : [
                                 {"aTargets": [0],
                                  "mRender" : function (data, type, full){
                                      return '&lt;input style="float:left; margin: 0 auto; width: 100%;" class="selected" type="checkbox" value="' + data + '"&gt;';
                                  }   
                                 }
                                 ],
              "aoColumns" : [{"mData" : "id"},
                             {"mData" : "title"},
                             {"mData" : "description"},
                             {"mData" : "datecreated"}],
  
              "fnInitComplete": function(oSettings, json){
                  //I do something here after init.
              }
               });
  </code></pre>
  
  <p>It works perfectly fine when there is some data in the list, but when the list is empty the Datatable just shows "Loading" message and i get type error: cannot handle null exception in browser console errors.
  I have temporarily fixed it by writing some jquery code to replace the "Loading..." message. Please guide.</p>