Opened 8 years ago

Closed 8 years ago

#119 closed defect (duplicate)

Currently no way to change uiProvider for LayerNode

Reported by: bartvde Owned by:
Priority: major Milestone: 0.6
Component: GeoExt.tree.LayerNode Version: trunk
Keywords: Cc:
State: None


This is because it is not possible to use something like the code below (after JSON write the defaults object will be empty):

        var treeConfig = new OpenLayers.Format.JSON().write([{
            nodeType: "gx_layercontainer",
            defaults: { defaultUI: GeoServices.tree.LayerNodeUI },
            expanded: true
        }], true);

So we need to do something like this on the loader:

            loader: new Ext.tree.TreeLoader({
            uiProviders: {'geoservices': GeoServices.tree.LayerNodeUI},
            clearOnLoad: true

and then use something like:

defaults: { uiProvider: 'geoservices' },

in the treeConfig.

But this does not work out of the box however. I need to investigate why this is not working.

Change History (6)

comment:1 Changed 8 years ago by ahocevar

Bart: your snippets above only work with tree nodes that are loaded by a loader, which the LayerContainers in current trunk do not use. Can you please apply the latest patch for #122 and see if it that makes it work?

comment:2 Changed 8 years ago by bartvde

Hi Andreas, I've checked out the patch for #122 and I needed to make 1 change to get the above to work (change is in LayerContainer.js):

    constructor: function(config) {
        this.loader = config.loader instanceof GeoExt.tree.LayerLoader ?
            config.loader : new GeoExt.tree.LayerLoader({
                store : config.layerStore,
                uiProviders: config.loader.uiProviders

The uiProviders were not passed on. Or do you expect me to explicitly use a LayerLoader instead of a default Ext tree loader in my config?

comment:3 Changed 8 years ago by ahocevar

Looking at the source code of Ext.tree.TreeLoader, I see that you also could do

defaults: { uiProvider: 'GeoServices.tree.LayerNodeUI' }

But I will provide a new patch shortly, which will take the uiProviders list from the owner tree. I will also remove the defaults attribute, because in Ext, there already is the baseAttrs attribute on the loader, which we should use instead. The one thing I will do though is that the loader configuration can be a config object for a loader, not just a loader instance.

comment:4 Changed 8 years ago by bartvde

  • Resolution set to fixed
  • Status changed from new to closed

This specific ticket can be closed, since this is incorporated into the patch for ticket:122 and I've verified that this works fine.

comment:5 Changed 8 years ago by tschaub

  • Resolution fixed deleted
  • Status changed from closed to reopened

Marking as a dupe of #122.

comment:6 Changed 8 years ago by tschaub

  • Resolution set to duplicate
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.