ExtJS Data Warehouse for Tree

I have a basic ExtJS question that I seem to be unable to solve based on reading documents and searching. I currently have a TreePanel that loads JSON directly from a URL. I am trying to separate the data from the view, so that I can also use this data to submit to the OpenLayers map (using GeoExt). How can I point a TreePanel to an Ext.data.Store file and not a URL?

+3
source share
3 answers

TreePanels use TreeLoaders, not stores, to load data. The reason is that trees require hierarchical data, and stores are flat table structures and do not support hierarchies. The main data objects also differ (Record compared to Node). Of course, you can store your own hierarchical data in the store using parent / child keys, but there is currently nothing like this for Ext components. If you are trying to cache tree data, you may need to discard your own solution for this.

EDIT: Now that Ext 4 is missing, this answer applies only to Ext 3. Ext 4 now has a (mostly) unified data model, and trees use TreeStore (with the optional NodeInterface applied to models) and no longer have a separate TreeLoader class.

+11

TreePanel URL- .

  loader: new Ext.tree.TreeLoader({
    url: '/path/to/data.json',
    requestMethod: 'GET',
    preloadChildren: true
  })

Store , , bmoeskau, .

+1

dataview, ( ) . URL-, , , , (tree dataview), , -.

, , , , .

, ( node), .

0

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


All Articles