lundi 19 mai 2014

[4.2.x/5-beta] TreePanel + BufferedRenderer = inconsistent display + errors

Use this fiddle :

http://ift.tt/1ndpJPA

or code below.

How to reproduce :

- scroll to the bottom

- expand node #271

=> children show on node #281

- expand another node ( previous one, #268 for instance )

=> same children misplacement

- scroll up

=> console blows up



Code:



Ext.require([
'Ext.*'
]);

Ext.define('TestModel', {
extend: 'Ext.data.TreeModel',
idProperty: 'id',
fields: [
{name: 'id', type: 'int'},
{name: 'code', type: 'string'},
{name: 'text', type: 'string'}
]
});

Ext.onReady(function() {
var idx = 1 ;

var createThreeChildren = function(node) {
if( node.getDepth() >= 4 ) {
node.collapse() ;
idx++ ;
node.appendChild({
id: idx,
code: 'CODE_'+idx,
text: 'Last expand 1',
leaf: true
}) ;
idx++ ;
node.appendChild({
id: idx,
code: 'CODE_'+idx,
text: 'Last expand 2',
leaf: true
}) ;
return ;
}
var childNode ;
for( var i=0 ; i<3 ; i++ ) {
idx++ ;
childNode = node.appendChild({
id: idx,
code: 'CODE_'+idx,
text: 'Text '+idx,
children: [],
expanded: true
}) ;
createThreeChildren(childNode) ;
}
} ;

var treestore = Ext.create('Ext.data.TreeStore',{
model: 'TestModel',
root: {
id: 1,
code: 'ROOT',
text: 'Root',
expanded: true,
children: []
},
proxy: {
type: 'memory' ,
reader: {
type: 'json'
}
}
}) ;

var treeroot = treestore.getRootNode() ;
createThreeChildren(treeroot) ;

Ext.create('Ext.tree.Panel',{
width: 500,
height: 600,
renderTo: Ext.getBody(),
animate: false,
useArrows: true,
rootVisible: true,
store: treestore,
plugins: [{
ptype: 'bufferedrenderer'
}],
columns: [{
xtype: 'treecolumn', //this is so we know which column will show the tree
text: 'Code',
width: 200,
dataIndex: 'code'
},{
text: 'Text',
width: 200,
dataIndex: 'text'
}],
}) ;
}) ;




Aucun commentaire:

Enregistrer un commentaire