source:
trunk/workshop-routing-foss4g/web/GeoExt/examples/attributes.js
@
76
Revision 76, 1.1 KB checked in by djay, 13 years ago (diff) | |
---|---|
|
Rev | Line | |
---|---|---|
[76] | 1 | /** |
2 | * Copyright (c) 2008-2010 The Open Source Geospatial Foundation | |
3 | * | |
4 | * Published under the BSD license. | |
5 | * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text | |
6 | * of the license. | |
7 | */ | |
8 | ||
9 | /** api: example[attributes] | |
10 | * Attribute Store & Reader | |
11 | * ------------------------ | |
12 | * Create records with attribute types and values with an AttributeStore. | |
13 | */ | |
14 | ||
15 | var store; | |
16 | Ext.onReady(function() { | |
17 | ||
18 | // create a new attributes store | |
19 | store = new GeoExt.data.AttributeStore({ | |
20 | url: "data/describe_feature_type.xml" | |
21 | }); | |
22 | store.load(); | |
23 | ||
24 | // create a grid to display records from the store | |
25 | var grid = new Ext.grid.GridPanel({ | |
26 | title: "Feature Attributes", | |
27 | store: store, | |
28 | cm: new Ext.grid.ColumnModel([ | |
29 | {id: "name", header: "Name", dataIndex: "name", sortable: true}, | |
30 | {id: "type", header: "Type", dataIndex: "type", sortable: true} | |
31 | ]), | |
32 | sm: new Ext.grid.RowSelectionModel({singleSelect:true}), | |
33 | autoExpandColumn: "name", | |
34 | renderTo: document.body, | |
35 | height: 300, | |
36 | width: 350 | |
37 | }); | |
38 | ||
39 | }); |
Note: See TracBrowser
for help on using the repository browser.