Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>try using just one store. It has to have a 'virtual' root node containing as many items as root nodes you want in the first level and set rootVisible: false in the tree. In this way you will have a tree like below:</p> <pre><code>non-visible root | +-- first root | : | +-- second root : </code></pre> <p>But given that you set rootVisible: false, what you will see is</p> <pre><code>+-- first root | : | +-- second root : </code></pre> <p>UPDATE This is the json that i have in my project (i have a tree that shows more than just one root)</p> <pre><code>{ "actions" : [{ "action" : "Version 1.3.21.0", "url" : "/Operations/Version%201.3.21.0" }, { "action" : "Version 1.3.16.0", "url" : "/Operations/Version%201.3.16.0" }] } </code></pre> <p>and this is the model that i use:</p> <pre><code>Ext.define('App.model.PluginAction', { extend : 'Ext.data.Model', fields : [ {name: 'text', mapping: 'action'}, 'url', 'description', { name: 'leaf', convert: function(val, data) { return data.raw &amp;&amp; data.raw.children; }} ], hasMany : { model: 'PluginAction', name: 'children'}, idProperty: 'text' }); </code></pre> <p>And my tree class definition:</p> <pre><code>Ext.define('App.view.layout.PluginActionTree', { extend: 'Ext.tree.TreePanel', alias: 'widget.pluginActionTree', hideHeaders: true, rootVisible: false, useArrows: true, lines: false, containerScroll: true, autoSize: true, layout: 'fit', model : 'App.model.PluginAction' } </code></pre> <p>Good luck!</p> <p><strong>Update:</strong> The problem is that trees can only have just one and only one root node. Once you know it what you have to do is create a root node (which will be hidden) and that root node has to have as many nodes has you need.</p> <pre><code>Ext.create('Ext.tree.Panel', { xtype : 'treepanel', hideHeaders: true, rootVisible: false, // this is important containerScroll: true, autoSize: true, layout: 'fit', root: { children : [ { text: 'root1' }, { text: 'root2' }] }, renderTo: Ext.getBody() });​ </code></pre> <p>this works! please, take a look at <a href="http://jsfiddle.net/FDY6v/" rel="nofollow">http://jsfiddle.net/FDY6v/</a> </p>
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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