filamentgroup / tablesaw

A group of plugins for responsive tables.
MIT License
5.48k stars 434 forks source link

header sorting is not working when append data from api #390

Closed samaz89 closed 1 year ago

samaz89 commented 4 years ago

Hi i'm using the the following to retrieve the data from the api , sorting is working when data is in the same html page but when append the row from the( js file)

sorting is not working , any thoughts may help me to get my issue fixed var output=""; function loadDataTable() {

$('#tableTestId > tbody').html("");

$.ajax({ type: 'GET', url: '//url', contentType: "text/plain", success: function (responce) {

  var data = JSON.parse(responce);
  mydata =data.Test;

  for(var i=0;i<mydata.length;i++){

    output +=
             "<tr><td>"+ mydata[i].A+"</td><td>"
            +mydata[i].B+
            "</td><td class='numbers'>"
            +mydata[i].C+
            "</td><td class='numbers'>"
            +mydata[i].D+
            "</td><td>"
            +mydata[i].E+
            "</td><td>"
            +mydata[i].F+
            "</td>/tr>";

  }

  $('#tableTestId > tbody').append(output);
   $('.table-responsive').responsiveTable('update');

},

}); }