Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't scrolling working in my jQuery UI sortable?

I'm having problems using the sortable function of jQuery UI. The scroll doesn't seem to work.

If the second list ( lists are created on the table rows in a tbody and each tbody is connect ) isn't visible I want it to be possible to scroll towards it for dropping my table row.

This is my HTML set up:

<ul>
    <li>
        <ul>
            <li>
                <table class="treeleerling">
                    <tbody class="oder0">

                        <tr class="suborder0">

                        </tr>
                        <tr class="sub1order">

                        </tr>
                    </tbody>
                </table>
            </li>
        </ul>
    </li>
    <li>
        <ul>
            <li>
                <table class="treeleerling">
                    <tbody class="oder1">

                        <tr class="suborder0">

                        </tr>

                        <tr class="suborder1">

                        </tr>
                    </tbody>
                </table>
            </li>
        </ul>
    </li>
</ul>

And jQuery code

$(document).ready(function() {
    $("#left tbody").sortable({
            connectWith : '#left tbody',
            scroll : true,
            scrollSensitivity: 40,
    });
});

The sorting works fine, but the scrolling doesnt.. I'm doing something wrong or what?

Update : I refactored the code to use only listitems in a list instead of table rows in a table body. Same problem still occurs

like image 348
Sam Vloeberghs Avatar asked Mar 22 '10 00:03

Sam Vloeberghs


2 Answers

This may not apply to your case, but I thought I would post my solution to a scolling problem with jQuery sortable that I was having. I'm not using a scrolling div. To get scrolling to work, I had to remove this line from my stylesheet:

body {
  overflow-x: hidden; /* this line kept page scrolling from working */
}

I also set the sortable 'containment' option to 'document' (which kept the item from being dragged left/right off the page, which is also what I needed).

like image 151
craig Avatar answered Oct 13 '22 06:10

craig


I just stumbled upon this. Might be too late for you but for any future visitors:

Had this problem and I had to delete the following line out of my css:

#sortable{overflow: auto;} /*delete this */

So I guess any kind of overflow assigned to the sortable could be the problem.

like image 38
Flink Avatar answered Oct 13 '22 05:10

Flink