javascript - tablesorter paging is not working on dynamically added rows -


i'm having trouble tablesorter paging on dynamically added rows. adding rows table looping data. table contain html controls in actual scenario. please me on this

 $('table').tablesorter({     sortlist: [       [0, 1],       [1, 1],       [2, 1]     ],     theme: 'blue',     showprocessing: false,     widthfixed: false,     widgets: ['zebra']   }).tablesorterpager({     container: $('.pager'),     savepages: false,     removerows: true,     page: 0,     size: 10,     output: 'page {page} sur {totalpages} ({totalrows})'   });  var eris = [ {"shippingline_cd":"aac","sizetype_cd":"20bu","eristatus_cd":"active","shift_nbr":"1"}, {"shippingline_cd":"acl","sizetype_cd":"20bu","eristatus_cd" :"active","shift_nbr":"2"}, {"shippingline_cd":"ama","sizetype_cd":"20dr","eristatus_cd" :"active","shift_nbr":"1"}, {"shippingline_cd":"abc","sizetype_cd":"20dr","eristatus_cd" :"pending","shift_nbr":"2"}, {"shippingline_cd":"cde","sizetype_cd":"20dr","eristatus_cd" :"pending","shift_nbr":"3"}, {"shippingline_cd":"aac","sizetype_cd":"20dr","eristatus_cd" :"active","shift_nbr":"1"}, {"shippingline_cd":"cde","sizetype_cd":"20bu","eristatus_cd" :"pending","shift_nbr":"1"}, {"shippingline_cd":"efg","sizetype_cd":"20bu","eristatus_cd" :"pending","shift_nbr":"1"} ]; var lstsizetype= $.unique(eris.map(function (d) {     return d.sizetype_cd;})); var tbody = $('#reservations tbody');                            var i=0, tr; if($("#trid1").length <= 0){ tr = $('<tr>').attr("id","trid1"); tr.append($('<td>').html(''));  $.each(lstsizetype, function(i, sizetype){ var lstshift = getlistbysizetype(sizetype); var lstshiftsunique= $.unique(lstshift.map(function (d) {     return d.shift_nbr;}));  var td = $('<td>').html(sizetype+lstshiftsunique.length).attr("id","td"+sizetype);  if(lstshift.length>1){ td.attr("colspan",lstshiftsunique.length); } tr.append(td); }); tbody.append(tr); }   if($("#trid2").length <= 0){ tr = $('<tr>').attr("id","trid2"); tr.append($('<td>').html('line'));  $.each(lstsizetype, function(j, sizetype){ var lstshifts= getlistbysizetype(sizetype);  var lstshiftsuniq= $.unique(lstshifts.map(function (d) {     return d.shift_nbr;}));  $.each(lstshiftsuniq,function(sft, shift){ $('<td>').html(getgetordinal(shift)+' shift').attr("id","td"+lstshifts[0].sizetype_cd+shift).appendto(tr);  });  }); tbody.append(tr); }  $.each(eris, function(i, eri){ if($("#tr"+eri.shippingline_cd).length <= 0){ tr = $('<tr>').attr("id","tr"+eri.shippingline_cd);  $('<td>').html(eri.shippingline_cd).attr("id","td"+eri.shippingline_cd).appendto(tr);    $.each(lstsizetype, function(j, sizetype){ var lstshifts= getlistbysizetype(sizetype);  var lstshiftsuniq= $.unique(lstshifts.map(function (d) {     return d.shift_nbr;}));  $.each(lstshiftsuniq,function(sft, shift){ $('<td>').html('').attr("id","td"+lstshifts[0].sizetype_cd+shift).appendto(tr);  });  });   tbody.append(tr); } });  $.each(eris, function(i, eri){  var togglectrl = '<b>abc</b>';   $("#tr"+eri.shippingline_cd).find("td#"+"td"+eri.sizetype_cd+eri.shift_nbr).html(togglectrl); });  $('.tablesorter').trigger('update');    function getlistbysizetype(sizetype) {   var = null;   var sellist = [];   (i = 0; eris.length > i; += 1) {     if (eris[i].sizetype_cd === sizetype) {       sellist.push(eris[i]);     }   }   return sellist; };  function findorremove(array, property, value, del) {   var recdeleted = false;   array.foreach(function (result, index) {     if (result[property] === value) {       //remove array       if (del)         array.splice(index, 1);       recdeleted = true;     }   });   return recdeleted; };  function getgetordinal(n) {                 var s = ["th", "st", "nd", "rd"],                 v = n % 100;                 return n + (s[(v - 20) % 10] || s[v] || s[0]);             }; 

please find samplecode. please me on this.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -