Note that there are some explanatory texts on larger screens.

plurals
  1. POExtjs4.2.1 - Load json to treepanel fails
    text
    copied!<p>I create a treepanel and I and create <code>store</code> like</p> <pre><code> var store = Ext.create('Ext.data.TreeStore', { autoload: false, proxy: { type: 'ajax', url: 'data.php', reader: { type: 'json', root: 'results' } } }); </code></pre> <p>my server print json look like</p> <pre><code>{ "results": [ { id : '1' , text : '1', expanded: true, children :[ { id : '5' , text : '5', leaf:true}, { id : '6' , text : '6', leaf:true} ] }, { id : '2' , text : '2', leaf:true}, { id : '3' , text : '3', leaf:true}, { id : '4' , text : '4', leaf:true}, { id : '7' , text : '7', leaf:true}, { id : '8' , text : '8', leaf:true}, { id : '9' , text : '9', leaf:true}, { id : '10' , text : '10', expanded: true, children :[ { id : '11' , text : '11', leaf:true}, { id : '12' , text : '12', leaf:true} ] } ] } </code></pre> <p>But when i run my code, i see firebug and that always run <code>GET http://localhost/example/data.php...</code> never stop :(</p> <p>and my tree is added so much double </p> <p>How to fix that thank</p> <p><b>Edit</b> <br>In real i define my treepanel with alias and using it as <code>xtype</code> <br>But i create new example and get same problem. Here is my js</p> <pre><code>var store = Ext.create('Ext.data.TreeStore', { autoload: false, proxy: { type: 'ajax', url: 'data.php', reader: { type: 'json', root: 'results' } } }); Ext.create('Ext.tree.Panel', { title: 'Simple Tree', width: 200, height: 150, store: store, rootVisible: false, renderTo: Ext.getBody() }); </code></pre> <p>And here is my <code>data.php</code></p> <pre><code>echo " { 'success': true, 'variable': 100, 'results': [ { id : '1' , text : '1', expanded: true, children :[ { id : '5' , text : '5', leaf:true}, { id : '6' , text : '6', leaf:true} ] }, { id : '2' , text : '2', leaf:true}, { id : '3' , text : '3', leaf:true}, { id : '4' , text : '4', leaf:true}, { id : '7' , text : '7', leaf:true}, { id : '8' , text : '8', leaf:true}, { id : '9' , text : '9', leaf:true}, { id : '10' , text : '10', expanded: true, children :[ { id : '11' , text : '11', leaf:true}, { id : '12' , text : '12', leaf:true} ] } ] }"; </code></pre>
 

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