Created
September 13, 2013 19:36
-
-
Save sergiomichels/6555068 to your computer and use it in GitHub Desktop.
Make sure to add NodeInterface fields in your model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| 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