# GeoExt

### Navigation

- GeoExt »
- API Reference »
- Widgets »
- `GeoExt.tree.LayerLoader`

# `GeoExt.tree.LayerLoader`

Extends
  - Ext.util.Observable

class `GeoExt.tree.``LayerLoader`
  A loader that will load all layers of a `GeoExt.data.LayerStore` By default, only layers that have displayInLayerSwitcher set to true will be included. The childrens’ iconCls defaults to “gx-tree-layer-icon”.

## Config Options

Configuration properties in addition to those listed for Ext.util.Observable.

`baseAttrs`
  An object containing attributes to be added to all nodes created by this loader.

`filter`

  `Function` A function, called in the scope of this loader, with a layer record as argument. Is expected to return true for layers to be loaded, false otherwise. By default, the filter checks for displayInLayerSwitcher:

      filter: function(record) {
          return record.getLayer().displayInLayerSwitcher == true
      }

`store`
  `GeoExt.data.LayerStore` The layer store containing layers to be added by this loader.

`uiProviders`
  `Object` An optional object containing properties which specify custom GeoExt.tree.LayerNodeUI implementations. If the optional uiProvider attribute for child nodes is a string rather than a reference to a TreeNodeUI implementation, then that string value is used as a property name in the uiProviders object. If not provided, the uiProviders object will be taken from the ownerTree’s loader.

## Public Methods

Public methods in addition to those listed for Ext.util.Observable.

`LayerLoader.``createNode`()

  Parameter: | attr – `Object` attributes for the new node

  Override this function for custom TreeNode node implementation, or to modify the attributes at creation time.

## Events

Events in addition to those listed for Ext.util.Observable.

`beforeload`

  Triggered before loading children. Return false to avoid loading children.

  Listener arguments:

  - loader - `GeoExt.tree.LayerLoader` this loader

  - node - `Ex.tree.TreeNode` the node that this loader is

      configured with

`load`

  Triggered after children wer loaded.

  Listener arguments:

  - loader - `GeoExt.tree.LayerLoader` this loader

  - node - `Ex.tree.TreeNode` the node that this loader is

      configured with

### Navigation

- index
- modules |
- next |
- previous |
- GeoExt »
- API Reference »
- Widgets »
- `GeoExt.tree.LayerLoader`