PDA

View Full Version : ColumnTree reloading a node and its children



philippe.suray
15 Sep 2009, 11:48 PM
Hello all,

I use a ColumTree Panel (taken from the example page) and a GridPanel in my application.
The purpose of the application is to assign tasks (from the grid) to technicians (in the treecolumn panel). Everytime I drop a task on a technician, i compute the distance and drive time of the travel. Thus for each technician, after dropping several tasks, I have a complete trip from technicain home to first task, second task, ... and return to home.

My problem is : i want to show the total distance, total driving time of the trip on the technician node, these informations must be modified every time a drop a task on a technician.

In the TreeLoader api, i can call the load(node, callback, scope) method to reload the children of the node, but in my case 'node' is the technician and i want to update also this one with total distance and total driving time.

Here is the init code of the TreeColumnPanel:



this.treeAssignedTask = new Ext.tree.ColumnTree({
rootVisible: false,
autoScroll: true,
width: 590,
height: 500,
enableDD: true,
ddGroup: 'grid2tree',
title: 'Assigned Tasks',
columns: [{
header: 'Name',
width: 165,
dataIndex: 'name'
}, {
header: 'Locality',
width: 125,
dataIndex: 'locality'
}, {
header: 'ETA',
width: 120,
dataIndex: 'eta'
}, {
header: 'Dist',
width: 50,
dataIndex: 'distance'
}, {
header: 'Driving',
width: 50,
dataIndex: 'drivingTime'
}, {
header: 'Working',
width: 50,
dataIndex: 'workingTime'
}],
loader: new Ext.tree.ColumnTreeLoader({
dataUrl: this.links.assignedTask,
uiProviders: {
'col': Ext.tree.ColumnNodeUI
},
preloadChildren: true
}),
root: new Ext.tree.AsyncTreeNode({
id: 'assigned-task-root',
text: 'Tasks'
})
});


Could you give an advise? How can i modify the TreeLoader, ColumnTree, ColumnNodeUI classes in order to acheive this behaviour?

Thanks a lot for your responses.

Phil