mjsarfattis nestedSortableプラグインを使用して階層的なデータ構造を構築しています。 アイテムがネストされないようにする方法はありますか?例:あなたが見ることができるようにjQuery nestedSortable:アイテムがネストされないようにする
phase 1
group
item
item
subgroup
item
item
item
item
item
item
item
phase 2
group
item
item
subgroup
item
item
item
item
、(サブ)グループまたはアイテムがthemselveが別の相または(サブ)グループ内にネストされてはならない段階が、段階内にネストすることができます。私はこの機能を扱う「mustBeRoot」プロパティを使用し、このケースでは
:_isAllowedビットを変更された:
_isAllowed: function(parentItem, levels) {
var o = this.options;
// Are we trying to nest under a no-nest or are we nesting too deep?
if (this.currentItem.hasClass(o.mustBeRoot) && this._getLevel(this.placeholder) != 0) {
this.placeholder.removeClass(o.mustBeRoot).addClass(o.errorClass);
if (this._getLevel(this.placeholder) == 1) {
this.placeholder.removeClass(o.errorClass).addClass(o.mustBeRoot);
}
this.beyondMaxLevels = 1;
} else 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;
}
}
},
[OK]を、私は別のフェーズ内での位相をドロップしようとした場合、これは正常に動作し、私はそれを少し深く(すなわち、サブグループ内に)ドラッグしてドロップすると、1つ上のレベルに「上がる」だけです。 -/
フェーズはルート要素のみでなければなりません。私はあなたに何か考えがあることを望む。