开发者

drag and drop of table rows using jquery TableDnD plugin how to make some ros not dragable and save the sorted rows?

i am using the code i have already implemented the table drag and drop what i want to make is some rows immovable like the top title bar row and the bottom submit button row how can that be achieved ?

and how to save the sorted list in database by click of a save button ?

$(document).ready(function() {
// Initialise the table
$("#table-1").tableDnD();
// DRAG AND DROP ENABLED 

});

my jquery code is this for dragging ->

i would appreciate开发者_JAVA百科 any help please ?


Add class="nodrag nodrop" to the row in which you don't want a drag or drop.

And add the following in the ondrop method:

$("#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);
    }
});

Hope that helps.

Rob www.formthis.com


Add two class names to your rows you don't want drag and droppable. tableDnD has these built into its code to prevent drag and drop In a gridview, this is how I achieve that...

<HeaderStyle CssClass="dgHead nodrop nodrag" />
<FooterStyle CssClass="NewMaterialEntry nodrop nodrag" VerticalAlign="Top" HorizontalAlign="Center" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜