Note that there are some explanatory texts on larger screens.

plurals
  1. POTreestore empty - is JSON valid?
    primarykey
    data
    text
    <p>My code looks like this but there is there is no data in the store / tree. </p> <p>Is the JSON store-valid? Do I need a <code>root</code> on top of the JSON?</p> <p>What columns must be defined in the Tree panel?</p> <p><strong>JSON:</strong></p> <pre><code>{ "status" : { "status" : 0, "msg" : "Ok", "protocolversion" : "1.1.json" }, "value" : { "name" : "Root", "path" : "\/", "leaf" : false, "children" : [ { "name" : "subfolder1", "path" : "\/subfolder1", "leaf" : false, "children" : [] }, { "name" : "subfolder2", "path" : "\/subfolder2", "leaf" : false, "children" : [] }, { "name" : "report1", "path" : "\/report1", "leaf" : true, "children" : [] } ] } } </code></pre> <p><strong>My ExtJs Code:</strong></p> <p><strong>Model:</strong></p> <pre><code>// Model for store var oModel = Ext.define('TreeModel', { extend: 'Ext.data.Model', fields: [ { name: 'name', type: 'string' }, { name: 'path', type: 'string' } ] }); </code></pre> <p><strong>Store:</strong></p> <pre><code> // Store with local proxy var oStore = Ext.create('Ext.data.TreeStore', { model: oModel, autoLoad: true, proxy: { type : 'ajax', url : './data/response.json' }, reader: { type : 'json', root : 'value' } }); </code></pre> <p><strong>TreePanel:</strong></p> <pre><code> // View with TreePanel var oTreePanel = Ext.create( 'Ext.tree.Panel', { store : oStore, useArrows : true, displayField: 'text', rootVisible : true, multiSelect : true, border : 0, columns : [ { xtype : 'treecolumn', dataIndex: 'name', text : 'Tree', flex : 3 }, { dataIndex: 'path', text : 'Path', flex : 2 } ] } ); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload