I got a table which is ordered by one of the td columns.. When a new row is inserted I need to get the index where the new row will fit without the alphabetical order is corrupted..
I got a method here, but it only works with numbers.. How can you make it work with strings too?
this.get_row_index = function(value, td_index){
var index = 0;
td_index = td_index ? td_index:0;
$('tr', this.scope.tbl_list).each(function(){
if(parseInt($('td', this).eq(td_index).html()) > value){
return false;
}
index++;
});
return index;
};
In javascript strings can just be compared with
>and<. So, removing theparseIntshould do it.