0
我有一個以頁眉和頁腳開頭的表格,並且用戶向它添加行。jQuery拖放以重新排序生成的表格
我希望用戶能夠以某種方式組織這些行,看起來拖放是最直觀的。
我似乎無法找到一個插件,或以其他方式代碼的東西,它適用於類似於.delegate或.live工作的實況內容。有任何想法嗎?
* 編輯:
我想出了這是一個臨時的解決方案重新排列用戶添加的行(我把上下表箭頭,用類.uparrow和.downarrow)。我仍然希望找到一種方法來拖放它們。
如果有人有興趣,這裏是箭頭代碼:
$('#garmenttable').delegate('.uparrow','click',function() {
var thisObj = $(this).closest('tr');
var prevTR = thisObj.prev('tr:not(.header)');
if(prevTR.length) {
prevTR.before(thisObj.clone(true, true));
thisObj.remove();
}
});
$('#garmenttable').delegate('.downarrow','click',function() {
var thisObj = $(this).closest('tr');
var nextTR = thisObj.next('tr:not(.footer)');
if(nextTR.length) {
nextTR.after(thisObj.clone(true, true));
thisObj.remove();
}
});