Hi,
I want to create a treelist in sencha modern through a json.
Sencha callback to server but no paint the treelist. Sencha no say any errors, but "Tree2" in console produces undefined although treeNode show constructor with json server.
View:
Code:
Ext.define('Myapp.view.main.MainConfig', {
extend: 'Ext.Panel',
requires: [Myapp.store.Tree],
xtype:'mainconfig',
{
xtype: 'treelist',
id: 'treelistDevices',
store:storeInterfacesId
//store:'Tree '
},
initialize(containerAux, eOpts)
{
var treeNode = Ext.getStore('storeInterfacesId');
console.log(treeNode);
var tree2 = Ext.getStore('Tree');
//tree2 undefined----
}
Store:
Code:
Ext.define('myapp.store.Tree', {
extend : 'Ext.data.Store',
model : 'myapp.model.Interface',
storeId: 'storeInterfacesId',
autoLoad : true,
proxy :
{
type : 'jsonp',
url : '------My url------------- ',
extraParams:
{
command: 'getJson'
},
reader : { type : 'json', rootProperty: 'Interfaces'}
}
});
Model:
Code:
Ext.define('Myapp.model.Interface', {
extend: 'Ext.data.Model',
config: {
fields: [
{ name: 'id', type:'string' },
],
hasMany: {
model: 'Device',
name: 'devices',
useNull: true
}
}
});
json tree.PNG
Captura.PNG
json.PNG