Dynamically load child tree nodes in open folder

I am new to extjs and I am trying to work with a tree.

I am creating an "API" and there are too many nodes to send as a single json object (several million nodes). Instead, I wanted to send the first category layer as json first, and then expand the ajax request to get all of these categories.

I am not sure how to do this or if it is possible. Can someone lead me in the right direction?

+4
source share
1 answer

This is actually the β€œnormal” way suggested in the documentation. Look at any of the tree examples .

Basically you create Ext.data.TreeStore with a proxy server, for example. Ext.data.proxy.Ajax :

xtype: 'treepanel', loadMask: {msg: 'Loading...'}, store: Ext.create('Ext.data.TreeStore', { proxy: { type: 'ajax', url: 'get-nodes.php' } }) 

Each time the user extends one of the nodes, the URL will be hit by the node parameter set to the id of the extended node and should return an array of children of this node. These children should not have the property of children, otherwise they will be considered already loaded and will not be loaded during expansion.

+4
source

Source: https://habr.com/ru/post/1443965/


All Articles