Skip to content Skip to sidebar Skip to footer

How To Make A Single Element In A Not Sortable (jquery Ui)

I have a table like this Not Sortable (jquery Ui)"
DaysMondayTuesdayW

Solution 1:

Make the row headers <th> as they should be and include only <td> elements.

<table><trclass="sortable"><th>Days</th><td>Monday</td>
     ...

​$( '​​​​.sortable' ).sortable({
    items: 'td'
});​​​​​

Demo: http://jsfiddle.net/Xugru/

Solution 2:

You can use the cancel option for this:

$('.sortable').sortable({
    cancel: 'td:first'
});

Here's docs.

Solution 3:

<table><trclass="sortable"><td>Days</td><td>Monday</td><td>Tuesday</td><td>Wednesday</td><td>Thursday</td><td>Friday</td><td>Saturday</td></tr><trclass="sortable"><td>Works</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td></tr></table>

Let's make the column id not to be sortable.

$(".sortable").sortable({
 items: "td:not(:first)"
});

That's all. All you need is to excludethe first td in items.

Have a great day

Post a Comment for "How To Make A Single

Element In A
Element?

I have a table and I need the cells to have an element posi…