2014-01-06 1 views
0

사용자가 리프를 드래그하여 순서를 지정할 때 리프가 해당 부모 내에서만 정렬 될 수있는 방식으로 트리가 작동해야합니다. .Extjs4 TreeGrid에서 부모 노드 내에서 리프 드래그/드롭 만 제한하는 방법

fruits and vegetables(Root) 
------\Fruits(Parent1) 
---------\Orange (Leaf1.1) 
---------\Apple (Leaf1.2) 
---------\Dragon Fruit (Leaf1.3) 
------\Veggie(Parent2) 
---------\Potato (Leaf1) 
---------\Beetroot (Leaf2) 
---------\Yam (Leaf3) 

순서화은 과일이나 야채 사이에 허용된다 : 하나는

예를 들면 ...이 나를 도울 수 있습니다. Leaf's 1.1,1.2,1.3은 상위 1 내에서만 정렬 될 수 있습니다. 감사.

+0

다음은 그 예입니다. http://docs.sencha.com/extjs/4.2.2/#!/example/tree/custom-drop-logic.html –

답변

0

코드별로 만 제출해야합니다. 드래그의 핸들러 기능에서, 타입이 야채 또는 과실인지, 그리고 부모의 타입이 동일한 지 확인하십시오. 둘 다 같지 않으면 아무 것도하지 않고 e.stopEvent()를 호출하십시오.

--Sridhar

0

대신 gridviewdragdroptreeviewdragdrop를 사용하고 수신기에 무언가를하십시오 : 그냥이 같은

nodedragover(targetNode, position, dragData, e, eOpts) 

:

view.on('nodedragover', function(node, position, dragData){ 
    var me = this, record = me.getRecord(node), srcNode = dragData.records[0]; 
    return srcNode.parentNode == record; 
}); 

내가 그것을 가지고 내 프로젝트.