Shijin TR
Shijin TR

Reputation: 7768

Sortable table with its parent tr

Here is my table

<table class="sortable">
    <tr class="sort_tr">
     <td>
       <table>
    <tr><td>data sub1</td></tr>
            <tr><td>data sub2</td></tr>
        </table>
     </td>
   </tr class="sort_tr">
      <tr>
        <td>data2</td>
      </tr>

And my script for make this table sortable is as follows,

       <script>
        $(function() {
         $( ".sortable" ).sortable({items:'tr'});
        });
       </script>

I want to sort only the child tr of table with class "sortable".but now it is able to sort tr of child table.How to disable sorting of child?

FIDDLE

Upvotes: 0

Views: 315

Answers (1)

Saurabh
Saurabh

Reputation: 1007

Do you want this kind of functionality

then i used :not() selector for it

here i made the selection of all <tr> in sortable class except for the table and tr in the sortable class

Fiddle Demo


Edited: Check this edited demo, is this what you want --> Updated demo

Upvotes: 2

Related Questions