0
我得到了一個由td列之一排序的表。當插入一個新行時,我需要獲取新行所適合的索引,而不會損壞字母順序。字母順序 - 行的返回索引
我在這裏有一個方法,但它只適用於數字..你怎樣才能使它與字符串一起工作呢?
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;
};
真的,我也將使用'的.text ()'而不是'.html()'來避免比較HTML。 –