![](/img/trans.png)
[英]how to store sorted table rows in cookies when jquery drag and drop is used?
[英]drag and drop of table rows using jquery TableDnD plugin how to make some ros not dragable and save the sorted rows?
我正在使用已經實現了表格拖放的代碼,我想使某些行不可移動,例如頂部標題欄行和底部提交按鈕行如何實現?
以及如何通過單擊保存按鈕將排序后的列表保存到數據庫中?
$(document).ready(function() {
// Initialise the table
$("#table-1").tableDnD();
// DRAG AND DROP ENABLED
});
我的jQuery代碼是用於拖動->
我需要任何幫助嗎?
將class =“ nodrag nodrop”添加到您不希望拖放的行中。
並在ondrop方法中添加以下內容:
$("#table-2").tableDnD({
onDragClass: "myDragClass",
onDrop: function(table, row) {
var rows = table.tBodies[0].rows;
var debugStr = "Row dropped was "+row.id+". New order: ";
for (var i=0; i<rows.length; i++) {
debugStr += rows[i].id+" ";
}
alert(debugStr);
},
onDragStart: function(table, row) {
$(#debugArea).html("Started dragging row "+row.id);
}
});
希望能有所幫助。
羅伯www.formthis.com
在您不想拖放的行中添加兩個類名。 tableDnD在其代碼中內置了這些功能,以防止在gridview中拖放,這是我實現此目標的方法...
<HeaderStyle CssClass="dgHead nodrop nodrag" />
<FooterStyle CssClass="NewMaterialEntry nodrop nodrag" VerticalAlign="Top" HorizontalAlign="Center" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.