Ticket #119 (closed defect: duplicate)

Opened 1 year ago

Last modified 1 year ago

Currently no way to change uiProvider for LayerNode

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

Description

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

07/15/09 14:27:01 changed 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?

07/16/09 09:25:17 changed 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?

07/17/09 18:13:50 changed 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.

07/24/09 12:47:46 changed by bartvde

  • status changed from new to closed.
  • resolution set to fixed.

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

10/13/09 23:48:19 changed by tschaub

  • status changed from closed to reopened.
  • resolution deleted.

Marking as a dupe of #122.

10/13/09 23:48:29 changed by tschaub

  • status changed from reopened to closed.
  • resolution set to duplicate.