Pregunta

Since I'm using jQuery UI's sortable extension nestedSortable I'm trying to accomplish to create multiple (connected) lists with each having their seperate option in maximum nested levels. But the plug-in checks for the amount of maximum levels in the original item (being dragged) instead of the place where it is supposed to be dropped.

<script type="text/javascript"> 
_isAllowed: function(parentItem, levels) {
    var o = this.options;
    // Are we trying to nest under a no-nest or are we nesting too deep?
    if (parentItem == null || !(parentItem.hasClass(o.disableNesting))) {
        if (o.maxLevels < levels && o.maxLevels != 0) {
            this.placeholder.addClass(o.errorClass);
            this.beyondMaxLevels = levels - o.maxLevels;
        } else {
            this.placeholder.removeClass(o.errorClass);
            this.beyondMaxLevels = 0;
        }
    } else {
        this.placeholder.addClass(o.errorClass);
        if (o.maxLevels < levels && o.maxLevels != 0) {
            this.beyondMaxLevels = levels - o.maxLevels;
        } else {
            this.beyondMaxLevels = 1;
        }
    }
}
</script>

How am I able to make this part of the plug-in select the maxLevel option of the location where the item is being dropped?

¿Fue útil?

Solución

I did a quick (dirty) fix to solve to problem:

<script type="text/javascript"> 
_isAllowed: function(parentItem, levels) {
    var o = this.options;
    o.maxLevels=$(this.placeholder[0]).closest('.ui-sortable').nestedSortable("option","maxLevels");
</script>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top