-
Reload tree problem: Uncaught TypeError: Cannot read property 'internalId' of undefi
Reload tree problem: Uncaught TypeError: Cannot read property 'internalId' of undefi
Hi all,
I have one an error in my ‘reload’of my tree. If any one can poitme the error! Tks!!
My code:
# Response (JSON)
// Initial Load
{
"success":"true",
"id":"a08dd1c2-82e4-423f-9713-e1d43d2982ee",
"cd":"0",
"list":
[{"text":"2009","id":"y:2009","leaf":"false","count":"1527","cls":"folder"},{"text":"2010","id":"y:2010","leaf":"false","count":"5624","cls":"folder"},{"text":"2011","id":"y:2011","leaf":"false","count":"6247","cls":"folder"},{"text":"2012","id":"y:2012","leaf":"false","count":"5992","cls":"folder"}]
}
// If I click in 2009 node (expand node)
{
"success":"true",
"id":"c1da69eb-cb25-4a4c-ad20-5ab156cb8c19",
"cd":"0",
"list":
[{"text":"08","id":"m:08:y:2009","leaf":"false","count":"61","cls":"folder"},{"text":"09","id":"m:09:y:2009","leaf":"false","count":"390","cls":"folder"},{"text":"10","id":"m:10:y:2009","leaf":"false","count":"411","cls":"folder"},{"text":"11","id":"m:11:y:2009","leaf":"false","count":"405","cls":"folder"},{"text":"12","id":"m:12:y:2009","leaf":"false","count":"260","cls":"folder"}]
}
# Model
Ext.define('Node', {
extend: 'Ext.data.Model',
idProperty: 'id',
fields: [
{name: 'text', type: 'string'},
{name: 'id', type: 'string'},
{name: 'count', type: 'string'}
]
});
# Store
var store = Ext.create('Ext.data.TreeStore', {
model: 'Node',
proxy: {
type: 'ajax',
url: 'dswapi/1.0/json/domain?did=test',
headers:
{
'Authorization' : 'test'
},
folderSort: true,
reader: {
type: 'json',
root: 'list'
}
},
root: {
text: 'Root',
id: 'src',
expanded: true
}
});
# my Tree
var tree = Ext.create('Ext.tree.Panel', {
store: store,
rootVisible: true,
dockedItems: [{
xtype: 'toolbar',
dock: 'bottom',
items: [{
text: 'Update',
icon: 'accept.png',
scope: this,
handler: function() { store.reload({params: {refresh: '1', from: 'reload'}}); // Uncaught TypeError: Cannot read property 'internalId' of undefined
}
}]
}],
columns: [{
xtype: 'treecolumn',
text: 'F',
flex: 2,
sortable: true,
dataIndex: 'text'
},{
text: '#',
flex: 1,
dataIndex: 'count',
sortable: true
}],
border: false,
bodyBorder:false,
width: 955,
maxWidth: 955,
height: 300,
renderTo: 'gridAnchor'
});
Any help!!!
tks
-
Sencha - Senior Forum Manager
What Ext JS 4 version are you using? I have used the load/reload method on the tree store just yesterday and it worked for me in 4.1.1
When posting code, please use BBCode's CODE tags
-
4.1.1 too. Sorry a will use in next post!
Sencha is used by over two million developers. Join the community, wherever you’d like that community to be
or Join Us