PDA

View Full Version : [FIXED] TreeStore with proxy duplicate list



anderfsilva
29 Nov 2011, 8:57 AM
The code as is works fine, but when I remove the "root: date" and uncomment the block that performs the query on the server it duplicates my list displaying twice "Drinks". I noticed that it makes twice requisitions the server.


Someone knows why does it makes two requests and duplicate the list?



Ext.application({


launch : function() {
var data = {
items : [{
text : 'Drinks',
items : [{
text : 'Water',
items : [{
text : 'Sparkling',
leaf : true
}, {
text : 'Still',
leaf : true
}]
}, {
text : 'Coffee',
leaf : true
}]
}]
};


Ext.regModel('model', {
fields : [{
name : 'text',
type : 'string'
}]
});


var store = new Ext.data.TreeStore({
model : 'model',
defaultRootProperty : 'items',
root : data
// proxy : {
// type : 'jsonp',
// url : 'http://192.168.0.4:9000/',
// reader : {
// type : 'json'
// }
// }
});


Ext.create('Ext.NestedList', {
fullscreen : true,
title : 'Menu',
displayField : 'text',
store : store
});


}
});


tks

mitchellsimoens
29 Nov 2011, 1:07 PM
Reporting this as a bug. Thank you for the test case!

anderfsilva
20 Dec 2011, 4:14 PM
Checking the source code I have identified that if the property "root" is not informed the TreeStore load method is called again, so just add "root: {}".



Ext.application({
launch : function() {

Ext.regModel('model', {
fields : [{
name : 'text',
type : 'string'
}]
});

var store = new Ext.data.TreeStore({
model : 'model',
defaultRootProperty : 'items',
root : {},
proxy : {
type : 'jsonp',
url : 'http://localhost:9000/',
reader : {
type : 'json'
}
}
});

Ext.create('Ext.NestedList', {
fullscreen : true,
displayField : 'text',
store : store
});

}
});

TommyMaintz
13 Jan 2012, 10:37 AM
This has been fixed as part of the data package cleanup, and will be part of the next Touch 2.0 release. We did a lot of work on TreeStore's, NodeStores and NodeInterface, hopefully reducing the number of bugs in it dramatically. Thanks again for the report and let us know if you still have issues related to this after the next release.