Skip to content

Instantly share code, notes, and snippets.

@sergiomichels
Created September 13, 2013 19:36
Show Gist options
  • Select an option

  • Save sergiomichels/6555068 to your computer and use it in GitHub Desktop.

Select an option

Save sergiomichels/6555068 to your computer and use it in GitHub Desktop.
Make sure to add NodeInterface fields in your model
/**
Custom model to a TreeStore. It's important to define text and qtip!
*/
Ext.define('MyApp.model.MyTreeModel',{
extend: 'Ext.data.Model',
fields: [{
name: 'text',
type: 'string'
},{
name: 'leaf',
type: 'boolean'
},{
name: 'qtip',
type: 'string'
},{
name: 'myCustomField'
}]
});
Ext.define('MyApp.store.MyTree',{
extend: 'Ext.data.TreeStore',
model: 'MyApp.model.MyTreeModel', //here if your model don't have text and leaf, it will not work properly
autoLoad: true,
root : {
text: 'Root',
expanded: true
},
proxy : {
type: 'ajax',
url: 'myurl.json',
reader : {
type: 'json'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment