jquery-sortable-lists icon indicating copy to clipboard operation
jquery-sortable-lists copied to clipboard

How to prevent child node to dragged in another parent node ... How to save Data to mysql and PHP

Open bugfirstx opened this issue 3 years ago • 1 comments

xZAfn (1)

Thank you

bugfirstx avatar Feb 01 '22 03:02 bugfirstx

In documentation first example there is C parant block, which does not allow insert item from another blocks. The code is related to isAllowed callback. There is also an examle code for this example:

var options = {
    isAllowed: function(currEl, hint, target)
    {
        if( hint.parents('li').first().data('module') === 'c' && currEl.data('module') !== 'c' )
        {
            hint.css('background-color', '#ff9999');
            return false;
        }
        else
        {
            hint.css('background-color', '#99ff99');
            return true;
        }
    }
} 

In another words every parent and his children has data-module attribute which identifies groups of items and you will check if hint parent has data-module compatible with dragged element.

To export list to structures which should be send to server there are three functions: sortableListsToArrayy(),sortableListsToHerarchy(), sortableListsToString(). This is the way to store it to database.

camohub avatar Feb 07 '22 13:02 camohub