PDA

View Full Version : [FIXED-410][3.1] TreeGrid: Folder changes to leaf icon on dragdrop



nextdigital
15 Dec 2009, 7:26 PM
To reproduce, use the code below and drag 'My List' into 'Another Folder'... you should notice the source folder's icon change to the default leaf icon.

I believe this is because it's <tr> CSS class changes to x-tree-node-leaf



Ext.onReady(function(){
var treegrid = new Ext.ux.tree.TreeGrid({
width: 500,
height: 300,
renderTo: Ext.getBody(),
enableDD: true,
columns:[{
id: 'name',
header: 'List Names',
width: 200,
sortable: true,
dataIndex: 'name'
},{
id: 'recipients',
header: 'Recipients',
width: 75,
sortable: true,
dataIndex: 'recipients'
},{
id: 'created',
header: 'Created',
width: 75,
sortable: true,
dataIndex: 'created'
},{
id: 'sent',
header: 'Sent',
width: 75,
sortable: true,
dataIndex: 'sent'
}]
});

var json = [{
"errors": 0,
"name": "A Folder",
"recipients": 0,
"created": 1260287731,
"duplicates": 0,
"unsubscribed": 0,
"active": 0,
"iconCls": "icon-list",
"bounced": 0,
"sent": 0,
"expanded": true,
"children": [{
"errors": 0,
"leaf": true,
"name": "A child List",
"recipients": 0,
"created": 1260287731,
"duplicates": 0,
"unsubscribed": 0,
"active": 0,
"iconCls": "icon-list",
"bounced": 0,
"sent": 0
}]
},{
"errors":0,
"name":"Another Folder",
"recipients":0,
"created":1260287731,
"duplicates":0,
"unsubscribed":0,
"active":0,
"iconCls":"icon-list",
"bounced":0,
"sent":0,
"children": []
}];

var root = new Ext.tree.AsyncTreeNode({
text: 'Lists',
draggable: false,
children: json,
id: 'root'
});
treegrid.setRootNode(root);
});

nextdigital
6 Jan 2010, 9:35 PM
Turns out this bug was in the base Ext.tree.TreeNodeUI

I altered the bolded line in updateExpandIcon:



if(!this.wasLeaf){
Ext.fly(this.elNode).replaceClass("x-tree-node-expanded", "x-tree-node-collapsed");
delete this.c1;
delete this.c2;
this.wasLeaf = true;
}

hendricd
7 Jan 2010, 11:29 AM
Fixed in SVN, 3.0.3, 3.1.0+