datatables: how to repopulate table after data changed? -


my goal repopulate/redraw/refresh table after aadata:'data' changed:

$(tableid).datatable({         "aadata": data,         "destroy": true,         "aocolumns": columns   }); 

i suceed tricky:

$(tableid).datatable().fncleartable(); $(tableid).datatable().fndestroy(); $(tableid).datatable({             "aadata": data,             "destroy": true,             "aocolumns": columns       }); 

which looks horrible. guess there must cleaner way ?

i've had struggle datatables also.

my solution:

var data = [json loaded ajax]

function loadtable(data){      if($.fn.datatable.isdatatable('#testslisttable')){          if(data.testrunreports.length == 0)             $('#testslisttable').datatable().fncleartable();         else             $('#testslisttable').datatable().fnadddata(data);          return;     }      $('#testslisttable').datatable({          data: data,  ... 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -