Jquery Datetable 行上移、下移 點擊 和 刪除事件


// 點擊
$('#insertRow').click(function(){
    var $tr = $('#templateTr').clone(true);
    $tr.attr('id','');
    $('#columnid tbody').append($tr);
    $tr.show();
});

// 刪除
$('#columnid .delrow').click(function(){
    var $tr = $(this).parents("tr");
    $tr.remove();
});
 // 升序
 function ascProductShow() {
alert("升序");
$(this).each(function(){
var $tr = $(this).parents("tr");
if($tr.index() != 0){
$tr.prev().before($tr);
}
});
 }
 
 // 降序
 function descProductShow() {
alert("降序");
var trLength = $(this).length;
     $(this).each(function(){
         var $tr = $(this).parents("tr"); 
         if (($tr.index() != trLength - 1 ) || $tr.index() == 0) { 
             $tr.next().after($tr);
         }
     });
 }

發佈了25 篇原創文章 · 獲贊 6 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章