PDA

View Full Version : Tree sortation and grid to tree dragging.



Nytrm
24 Mar 2010, 7:58 AM
Hello

I would like to be able to drag and drop rows from my grid into a node on my tree and be able to sort the tree nodes at the same time.

I am able to do both, but not both at the same time.
Its or drag and drop rows to a node or sort nodes.

Is here any way to check on source what your trying to drag?

if a node has been selected use tree sortation function or if a grid row is being dragged use the other function.

I just cant seem to have both at the same time.

Example code of my tree sortation

this.tree.on('nodedrop', this.treeOnNodeDrop, this);

this.treeOnNodeDrop = function(dropEvent) {
if (dropEvent.dropNode.id.substring(0, this.treeIdPrefix.length) == this.treeIdPrefix) {
var target = dropEvent.target.id;
var id = dropEvent.dropNode.id;
var point = dropEvent.point;

function success(response, options) {
this.reloadTree();
}
function failure(response, options) {
this.reloadTree();
}

Eva.Ajax.request('appadmin/moveComponentTab', {node: id, target: target, point: point},
{ success: success, failure: failure, scope:this });
}
}Example of my drop config inside the tree

dropConfig:
{
ddGroup: 'componentsGrid',
dropAllowed: true,
appendOnly: true,
notifyDrop: function(source, e, data) {
console.log(source);
var r=data.selections[0];
// id van het geselecteerde component
console.log(r.data.id);
// id van de tab waarin het component gesleept is.
console.log(e.target.id)
}
}

hhangus
24 Mar 2010, 8:28 AM
"Is here any way to check on source what your trying to drag?"



dropEvent.source


*cough* read the api *cough*

Nytrm
24 Mar 2010, 2:40 PM
"Is here any way to check on source what your trying to drag?"



dropEvent.source
*cough* read the api *cough*
I am sorry i must have overread it =)

Thanks Alot !