rahul
rahul

Reputation: 19

I want to disable Jquery tablednd

Hi i have used jquery tablednd. I have written a function which initializes the tablednd to a table

But i want to know if there is any option of disabling the tablednd...??

Upvotes: 2

Views: 4019

Answers (3)

Shen
Shen

Reputation: 21

I think the exact way to disable tableDnd show be: remove the 'mousedown' bind of td.

So the example is:

html:

<table id="first-table"> ..... </table>
<table id="second-table"> ..... </table>

javascript:

<script type="text/javascript>
// disable first table
jQuery("#first-table td").unbind("mousedown");

// enable second table
jQuery("#second-table").removeclass("nodrag nodrop").tableDnD();
</script>

Upvotes: 2

Joshua Belliveau
Joshua Belliveau

Reputation: 86

I was able to disable the tableDnD by calling the following function:

function tableDragAndDropDisable(cssID){
    $(cssID + " tr").addClass("nodrag nodrop");
}

// sample usage
tableDragAndDropDisable("#sortable_table");

This will add the "nodrag nodrop" classes to each row of the table with the given ID (cssID) - effectively disabling the table of its sorting ability.

Upvotes: 6

Andreas
Andreas

Reputation: 685

you can remove the cssclasses nodrop and nodrag

rows.removeClass('nodrop nodrag');

where rows are the table rows

Upvotes: 0

Related Questions