May be this question is asked before but i am stuck in a position where i am able to sort my data table at the time of page loading.But when i replace the whole table with data populated by ajax then it stops working.Please help me.
i am using the following code according to jQuery table sort
$('#loc_sort, #rate_sort') // these are the th ids that i want to sort
.wrapInner('<span title="sort this column"/>')
.each(function(){
var th = $(this),
thIndex = th.index(),
inverse = false;
th.click(function(){
table.find('td').filter(function(){
return $(this).index() === thIndex;
}).sortElements(function(a, b){
return $.text([a]) > $.text([b]) ?
inverse ? -1 : 1
: inverse ? 1 : -1;
}, function(){
// parentNode is the element we want to move
return this.parentNode;
});
inverse = !inverse;
});
});
please tell me how can i use this code with .on method.I append the html code that coming from ajax to
<div id="outer_all_div"></div>
div.Which is not replacing.Please help me.Thanks in advance.