Changeset 268


Ignore:
Timestamp:
03/25/09 00:09:00 (9 years ago)
Author:
tschaub
Message:

adding handy map preview to capabilities grid

Location:
sandbox/opengeo/geoexplorer/examples
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sandbox/opengeo/geoexplorer/examples/wms-capabilities.html

    r265 r268  
    1515        <h1>WMS Capabilities Example</h1>
    1616        <p>This example shows how to load a grid with data from a WMS
    17         capabilities document.</p>
     17        capabilities document.  You can double-click on a row to see
     18        a map preview of the layer.</p>
    1819
    1920        <p>Note that the js is not minified so it is readable.
  • sandbox/opengeo/geoexplorer/examples/wms-capabilities.js

    r265 r268  
    2121        renderTo: "capgrid",
    2222        height: 300,
    23         width: 600
     23        width: 600,
     24        listeners: {
     25            rowdblclick: mapPreview
     26        }
    2427    });
     28   
     29    function mapPreview(grid, index) {
     30        var record = grid.getStore().getAt(index);
     31        var layer = record.get("layer");
     32        layer.isBaseLayer = true; // default is false
     33       
     34        var win = new Ext.Window({
     35            title: "Preview: " + record.get("title"),
     36            width: 512,
     37            height: 256,
     38            items: [{
     39                xtype: "gx_mappanel",
     40                layers: [layer],
     41                extent: new OpenLayers.Bounds.fromArray(record.get("llbbox")) // simplify when #31 is addressed
     42            }]
     43        });
     44        win.show();
     45    }
    2546
    2647});
Note: See TracChangeset for help on using the changeset viewer.