我有动态表,我必须通过coladdButton添加列。 然后动态添加列我需要使用jquery向左和向右移动。
注意:第一列应该是常量。它不应该移动到任何地方。
从第二列到第n列,我可以从左到右,从右到左移动。
我尝试过使用Draggable插件。 请Col添加源代码:
$( “#号coladd”)。在( “点击”,函数(){
var colsize = $("#testDtbl th").length;
var rowsize = $("#testDtbl tr").length;
if($("#renCol").val().trim() == "" || $("#renCol").val() == null){
return false;
}
$("#row0").append('<th bgcolor="#CCCCCC">'+$("#renCol").val()+'</th> <input type="hidden" name="cellVal[0]['+colsize+']" value="'+$("#renCol").val()+'" >');
for(var i=1; i<=rowsize; i++){
$("#row"+i).append('<td><input type="text" name=cellVal['+i+']['+colsize+'] /></td>');
'<td><input type="checkbox" />';
}
});