PDA

View Full Version : Preventing reordering in certain nodes of TreePanel



sam.vloeberghs
9 Nov 2010, 4:48 AM
Hi Folks,

I'm new to Ext JS but/and eager to learn! I love the Tree stuff and it comes in very handy! But unfortunatly I'm having problems preventing certain ordering.

( My native language ain't english but I'll try to express myself the best I can .. I hope everything is clear enough.. :) )

I have , for example this structure:

- School
+ Year 1
* Group 1
Student 1
Student 2
Student 3
..

* Group 2
Student 1
Student 2
Student 3
..

* ...

+ Year 2
* Group 1
Student 1
..

* Group 2
Student 1
Student 2
Student 3
..

* ..

This structure is builded using a Lazy tree, so everytime you open a node, it's contents are loaded using a PHP callback script ( I modified this example :
http://dev.sencha.com/deploy/dev/examples/tree/reorder.html (http://dev.sencha.com/deploy/dev/examples/tree/reorder.html)
to fit my needs )

Now what I'm trying to achieve is that Students can be reordered within Groups but ONLY within groups ( so they can not be losely dropped within years ( they have to be connected to a Group ). I got this logic working by using the allowDrag and allowDrop configuration options.

( now coming to my main problem )

Apart from that I'm also trying to make it so that Groups can be reordered within Years. These Groups on the other hand may not be placed inside another group or in or in the rootnode ' School ' .

So this structure should not be allowed :

+ Year 2
* Group 1
Student 1
..

* Group 2
Student 1
Student 2
Student 3
Group 3
Student 1
...

Can this logic be achieved using the allowDrop or/and allowDrag configuration options? If not are their other ways to achieve this?

I hope I made myself clear and if not I'm verry happy to provide further information!

Greetings from a Ext JS noobie! :)
Sam Vloeberghs

sam.vloeberghs
14 Nov 2010, 11:57 PM
bump!