PDA

View Full Version : Tree grid is not scrolling during dragging



jagdeep.sharma
2 Nov 2012, 2:21 AM
I am showing a tree grid and have long list items nested within folders. The problem is when user tries to drop an item to a folder which he can't see and for that he has to scroll up. So he can't scroll with an item selected. How can I make my tree scrollable?

// create the Tree
var tree = Ext.create('Ext.tree.Panel', {
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop',
appendOnly: true
},
listeners: {
drop: function (node, data, overModel, dropPosition) {
var rec = data.records[0];
Ext.Ajax.request({
url:'/apex/getTreeJson',
params:{
action: 'save',
folderId: overModel.get('id'),
documentId: rec.get('id'),
type: rec.get('type')
}
})

}
}
},
columns: [{
xtype: 'treecolumn', //this is so we know which column will show the tree
text: 'Title',
flex: 1,
sortable: true,
dataIndex: 'text'
},
{
//xtype: 'templatecolumn',
text: 'To/From',
flex: 1,
sortable: true,
dataIndex: 'to_or_from'
},
{
//xtype: 'templatecolumn',
text: 'Created Date',
flex: 1,
sortable: true,
dataIndex: 'created_date',
renderer: function(value) {
var dt = new Date(value);
var val = Ext.Date.format(dt,'m/d/Y');
return val;
}
},
{
//xtype: 'templatecolumn',
text: 'Created By',
flex: 1,
sortable: true,
dataIndex: 'created_by'
}],

store: store,
height: 250,
width: '100%',
//title: 'Tree Sample',
rootVisible: true,
renderTo: 'tree',
autoScroll: true,
listeners: {
itemdblclick: function(view, node){

if (node.get('type') == 'Folder' || node.get('type') == 'Root') {
return false;
} else {
download(node.get('contentDocumentId'));
}
}
}
});

mitchellsimoens
5 Nov 2012, 6:21 AM
If you set containerScroll to true it is suppose to be able to scroll then.

jagdeep.sharma
5 Nov 2012, 10:39 PM
I tried that too but that didn't work out. Could you please point me to some sample of tree grid which supports scrolling while selection?

ettavolt
6 Nov 2012, 6:49 AM
Actually, treeviewdragdrop plugin doesn't support configuring underlying Drag and Drop Zones. To work around this try Ext.dd.ScrollManager.register(this.view.el); in boxready event of treepanel.

jagdeep.sharma
6 Nov 2012, 7:34 PM
I am unable to find boxready event of treepanel. Could you please provide a link for its documentations?