Im using nestedSortable and for some time it works fine but after about 1min of use it breakes down and does not return entire list but only part of it. Im using toArray to return data back to php script which then fills in mysql but if returned json value is not for entire list update messes up the database.

Is anyone having trouble with this strange behavior or am I doing something wrong ?

            $('#load').click(function(){
            $.get("get_tags.php", function(data){
                $("#data").html(data);
                $('ol.sortable').nestedSortable({
                    disableNesting: 'no-nest',
                    forcePlaceholderSize: true,
                    handle: 'div',
                    helper: 'clone',
                    items: 'li',
                    maxLevels: 3,
                    opacity: .6,
                    placeholder: 'placeholder',
                    errorClass: 'error',
                    revert: 250,
                    tabSize: 25,
                    tolerance: 'pointer',
                    toleranceElement: '> div',
                    update: function () {
                        list = $(this).nestedSortable('toArray');
                        $("#result2").html(JSON.stringify(list));
                        $.post('x.php', { update_sql: 'ok', list: JSON.stringify( list ) },
                            function(data){
                                $("#result").html(data);
                            }, 
                                "html" )
                    }
                }); 
            }); 
        });
有帮助吗?

解决方案

You appear to be using some jQuery plugin which has zero unit tests and hasn't been touched or updated for 8 months.

It was build for jQuery 1.4 and if you look at the code you can see it's messy.

Your options are

  • Debug the code and see if you can fix it.
  • Don't use untested third party plugins and rewrite the functionality yourself.

Basically you expected you could copy and paste some lump of code from the internet and it would just work. That's not the case.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top