File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 1919 %p = show_code_button
2020 .span4
2121 %h3 Sortable Rows
22- %table .table.table-striped.table-bordered
22+ %table .table.table-striped.table-bordered.sorted_table
2323 %thead
2424 %tr
2525 %th A Column
2626 %th B Column
27- %tbody .sorted_table
27+ %tbody
2828 = iterate(6) do |i, name|
2929 %tr
3030 %td A #{name}
Original file line number Diff line number Diff line change 11$ ( function ( ) {
22 // Sortable rows
33 $ ( '.sorted_table' ) . sortable ( {
4- containerSelector : 'tbody' ,
4+ containerSelector : 'table' ,
5+ itemPath : '> tbody' ,
56 itemSelector : 'tr' ,
67 placeholder : '<tr class="placeholder"/>'
78 } )
Original file line number Diff line number Diff line change 4747 // This is executed after the placeholder has been moved.
4848 afterMove : function ( $placeholder , container ) {
4949 } ,
50+ // The exact css path between the container and its items, e.g. "> tbody"
51+ containerPath : "" ,
5052 // The css selector of the containers
5153 containerSelector : "ol, ul" ,
5254 // Distance the mouse has to travel to start dragging
5355 distance : 0 ,
5456 // The css selector of the drag handle
5557 handle : "" ,
58+ // The exact css path between the item and its subcontainers
59+ itemPath : "" ,
5660 // The css selector of the items
5761 itemSelector : "li" ,
5862 // Check if the dragged item may be inside the container.
527531 return ! this . disabled && ( ! this . parentContainer || this . parentContainer . enabled ( ) )
528532 } ,
529533 $getChildren : function ( parent , type ) {
530- return $ ( parent ) . find ( this . rootGroup . options [ type + "Selector" ] )
534+ var options = this . rootGroup . options ,
535+ path = options [ type + "Path" ] ,
536+ selector = options [ type + "Selector" ]
537+
538+ parent = $ ( parent )
539+ if ( path )
540+ parent = parent . find ( path )
541+
542+ return parent . children ( selector )
531543 } ,
532544 _serialize : function ( parent , isContainer ) {
533545 var that = this ,
You can’t perform that action at this time.
0 commit comments