Hi Yingqi,

you could use the defaults property of the LegendPanel:

    var legendPanel = new GeoExt.LegendPanel({
        defaults: {
            labelCls: 'legendpanel-layername',
            style: 'padding:5px',
            clickableSymbol: true,
            clickableTitle: true,
            selectOnClick: true,
            listeners: {
                symbolclick: function(comp, rule){ alert('symbolclick'); },
                titleclick: function(comp, rule){ alert('titleclick'); },
                ruleclick: function(comp, rule){ alert('ruleclick'); },
ruleselected: function(comp, rule){ alert('ruleselected'); }
            }
        },
        autoScroll: true
    });

Regards,

Marc



On 24.08.2010 01:58, Yingqi Tang wrote:
Hi,

Is there any example or doc demonstrating how to add event listener to legend entry of GeoExt legend panel? For example, I saw in the source code of VectorLegend.js there are events like "titleclick", "symbolclick", ...etc. and I assume that's where you can add callback when a legend title or symbol is clicked. The existing example only shows how to add a legend panel so it's not obvious to me how to add event listener through LegendPanel?

Does one have to create legend using VectorLegend directly to manipulate those events?

Thanks


_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users


--

  .................................................................
   Karten im (Inter|Intra)net?

   OpenLayers - Webentwicklung mit dynamischen Karten und Geodaten
   von M. Jansen und T. Adams, OpenSourcePress, München.

   ISBN: 978-3-937514-92-5
   URL:  http://openlayers-buch.de
  .................................................................


  Dipl.-Geogr. Marc Jansen
  - Anwendungsentwickler -

  terrestris GmbH&  Co. KG
  Irmintrudisstraße 17
  53111 Bonn

  Tel:    ++49 (0)228 / 96 28 99 -53
  Fax:    ++49 (0)228 / 96 28 99 -57

  Email:  [email protected]
  Web:    http://www.terrestris.de

  Amtsgericht Bonn, HRA 6835
  Komplementärin:  terrestris Verwaltungsgesellschaft mbH
  vertreten durch: Hinrich Paulsen, Till Adams


_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to