[Users] Legend in Accordion panel
Luís de Sousa
luis.a.de.sousa at gmail.com
Tue May 28 09:55:47 CEST 2013
Dear all,
I have done a good deal of testing on the Legend object and it seems to
function only in this unique setting:
a) it must added in line to a panel with layout defined as 'border';
b) a MapPanel object must be also part of the items of this 'border' layout
panel.
Although I don't recall seeing an example with a different setting, I doubt
the Legend object can be this restrictive. Thus I'd request again for you
to look into my code to check what may be wrong.
Thank you,
Luís
On 22 May 2013 10:06, Luís de Sousa <luis.a.de.sousa at gmail.com> wrote:
> Dear all,
>
> I've tried to add the LegendPanel object to the main panel in several ways
> but it never works (appears simply blank). The only way the LegendPanel is
> correctly associated with the map is by defining it in line in the items
> array of the main panel (that must contain a MapPanel) and without
> specifying a LayerStore. Please see below two configuration examples
> showing who it works and how it doesn't.
>
> My first question: is this the way it is supposed to be or am I missing
> something in the LegendPanel configuration?
>
> And secondly: is there any other way to show a legend with GeoExt?
>
> Thank you,
>
> Luís
>
>
> /****************************************************************************
> * Config 1: Legend defined in line without layerStore - it works
>
> var mapPanel = new GeoExt.MapPanel({
> region: "center",
> collapsible: false,
> floatable: false,
> xtype: "gx_mappanel",
> map: map
> });
>
> var LayerNodeUI = Ext.extend(
> GeoExt.tree.LayerNodeUI,
> new GeoExt.tree.TreeNodeUIEventMixin()
> );
>
> var treeConfig = [{
> nodeType: "gx_baselayercontainer",
> expanded: true
> }, {
> nodeType: "gx_overlaylayercontainer",
> expanded: true
> }];
>
> var treePanel = new Ext.tree.TreePanel({
> itemId:'navTree',
> region: "east",
> title: "Layers",
> width: 170,
> collapsible: true,
> autoScroll: true,
> enableDD: true,
> plugins: [{
> ptype: "gx_treenodecomponent"
> }],
> loader: {
> applyLoader: false,
> uiProviders: {"custom_ui": LayerNodeUI}
> },
> root: {children: treeConfig},
> rootVisible: false,
> lines: false
> });
>
> var mainPanel = new Ext.Panel({
> layout:'border',
> bodyBorder: false,
> renderTo: "MiniMap",
> stateId: "MiniMap",
> height: 400,
> width: 700,
> defaults: {
> split: true,
> autoHide: false,
> useSplitTips: true,
> },
> items: [mapPanel, treePanel,
> {
> title: "Legend",
> xtype: "gx_legendpanel",
> region:'west',
> width: 100,
> collapsible: true,
> autoScroll: true,
> enableDD: true,
> padding: 5,
> rootVisible: false,
> lines: false
> }]
> });
>
> /****************************************************************************/
>
>
> /****************************************************************************
> * Config 2: Legend defined as a variable with layerStore - doesn't work
>
> var mapPanel = new GeoExt.MapPanel({
> region: "center",
> collapsible: false,
> floatable: false,
> xtype: "gx_mappanel",
> map: map
> });
>
> var myLayerStore = new GeoExt.data.LayerStore({
> map: map,
> layers: map.layers
> });
>
> var legendPanel = new Ext.Panel({
> title: "Legend",
> xtype: "gx_legendpanel",
> layerStore: myLayerStore,
> region:'west',
> width: 100,
> collapsible: true,
> autoScroll: true,
> enableDD: true,
> padding: 5,
> rootVisible: false,
> lines: false
> });
>
> var LayerNodeUI = Ext.extend(
> GeoExt.tree.LayerNodeUI,
> new GeoExt.tree.TreeNodeUIEventMixin()
> );
>
> var treeConfig = [{
> nodeType: "gx_baselayercontainer",
> expanded: true
> }, {
> nodeType: "gx_overlaylayercontainer",
> expanded: true
> }];
>
> var treePanel = new Ext.tree.TreePanel({
> itemId:'navTree',
> region: "east",
> title: "Layers",
> width: 170,
> collapsible: true,
> autoScroll: true,
> enableDD: true,
> plugins: [{
> ptype: "gx_treenodecomponent"
> }],
> loader: {
> applyLoader: false,
> uiProviders: {"custom_ui": LayerNodeUI}
> },
> root: {children: treeConfig},
> rootVisible: false,
> lines: false
> });
>
> var mainPanel = new Ext.Panel({
> layout:'border',
> bodyBorder: false,
> renderTo: "MiniMap",
> stateId: "MiniMap",
> height: 400,
> width: 700,
> defaults: {
> split: true,
> autoHide: false,
> useSplitTips: true,
> },
> items: [mapPanel, treePanel, legendPanel]
> });
>
> /****************************************************************************/
>
>
> On 21 May 2013 11:52, Luís de Sousa <luis.a.de.sousa at gmail.com> wrote:
>
>> Hello everyone,
>>
>> I'm trying to integrate a Legend panel into an accordion, with the
>> following set up:
>>
>> myLayerStore = new GeoExt.data.LayerStore({
>> map: myMap,
>> layers: myMap.layers
>> });
>>
>> myLegend = new Ext.Panel({
>> title: "Legend",
>> xtype: "gx_legendpanel",
>> layerStore: myLayerStore,
>> collapsible: true,
>> autoScroll: true,
>> enableDD: true,
>> padding: 5,
>> rootVisible: false,
>> lines: false
>> });
>>
>> And then myLegend is included in the items array of the Accordion panel.
>>
>> This way the Legend panel doesn't work, it doesn't send any requests to
>> the server and remains blank. What is wrong in this set up?
>>
>> Thank you,
>>
>> Luís
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20130528/ca3c804f/attachment.htm
More information about the Users
mailing list