[Commits] r2431 - sandbox/cmoullet/ux/OpenAddressesSearchCombo/examples

commits at geoext.org commits at geoext.org
Thu Oct 7 05:41:29 CEST 2010


Author: cmoullet
Date: 2010-10-07 05:41:29 +0200 (Thu, 07 Oct 2010)
New Revision: 2431

Added:
   sandbox/cmoullet/ux/OpenAddressesSearchCombo/examples/OpenAddressesAccessSample.html
Log:
Sample AJAX query

Added: sandbox/cmoullet/ux/OpenAddressesSearchCombo/examples/OpenAddressesAccessSample.html
===================================================================
--- sandbox/cmoullet/ux/OpenAddressesSearchCombo/examples/OpenAddressesAccessSample.html	                        (rev 0)
+++ sandbox/cmoullet/ux/OpenAddressesSearchCombo/examples/OpenAddressesAccessSample.html	2010-10-07 03:41:29 UTC (rev 2431)
@@ -0,0 +1,61 @@
+<html>
+<head>
+    <title>Sample access to OpenAddresses with ExtJS</title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+
+    <script type="text/javascript" src="http://svn.geoext.org/ext/3.1.0/adapter/ext/ext-base.js"></script>
+    <script type="text/javascript" src="http://svn.geoext.org/ext/3.1.0/ext-all.js"></script>
+    <link rel="stylesheet" type="text/css" href="http://svn.geoext.org/ext/3.1.0/resources/css/ext-all.css"/>
+    <link rel="stylesheet" type="text/css" href="http://svn.geoext.org/ext/3.1.0/examples/shared/examples.css"/>
+    <script type="text/javascript">
+        Ext.onReady(function() {
+            var store = new Ext.data.Store({
+                proxy: new Ext.data.ScriptTagProxy({
+                    url: 'http://www.openaddresses.org/addresses/?query=payerne',
+                    method: 'GET'
+                }),
+                baseParams: {
+                    limit: 10,
+                    lang: 'en',
+                    attrs: "street,housenumber,city"
+                },
+                reader: new Ext.data.JsonReader({
+                    root: 'features',
+                    fields: [
+                        {
+                            name: 'geometry'
+                        },
+                        {
+                            name: 'properties'
+                        },
+                        {
+                            name: 'street',
+                            mapping: 'properties.street'
+                        },
+                        {
+                            name: 'city',
+                            mapping: 'properties.city'
+                        },
+                        {
+                            name: 'housenumber',
+                            mapping: 'properties.housenumber'
+                        }
+                    ]
+                }),
+                listeners: {
+                    'load': function() {
+                        alert("First id loaded: " + this.reader.jsonData.features[0].id);
+                    }
+                }
+
+            });
+            store.load();
+        });
+    </script>
+
+</head>
+
+<body>
+
+</body>
+</html>
\ No newline at end of file



More information about the Commits mailing list