[Commits] r2498 - in sandbox/cmoullet/ux/Mobile: . ux ux/SwissSearchMobile ux/SwissSearchMobile/lib ux/SwissSearchMobile/lib/GeoAdminMobile.ux
commits at geoext.org
commits at geoext.org
Sun Nov 28 05:59:23 CET 2010
Author: cmoullet
Date: 2010-11-28 05:59:23 +0100 (Sun, 28 Nov 2010)
New Revision: 2498
Added:
sandbox/cmoullet/ux/Mobile/ux/
sandbox/cmoullet/ux/Mobile/ux/SwissSearchMobile/
sandbox/cmoullet/ux/Mobile/ux/SwissSearchMobile/examples/
sandbox/cmoullet/ux/Mobile/ux/SwissSearchMobile/lib/
sandbox/cmoullet/ux/Mobile/ux/SwissSearchMobile/lib/GeoAdminMobile.ux/
sandbox/cmoullet/ux/Mobile/ux/SwissSearchMobile/lib/GeoAdminMobile.ux/SwissSearchMobile.js
Log:
Very first Mobile UX
Added: sandbox/cmoullet/ux/Mobile/ux/SwissSearchMobile/lib/GeoAdminMobile.ux/SwissSearchMobile.js
===================================================================
--- sandbox/cmoullet/ux/Mobile/ux/SwissSearchMobile/lib/GeoAdminMobile.ux/SwissSearchMobile.js (rev 0)
+++ sandbox/cmoullet/ux/Mobile/ux/SwissSearchMobile/lib/GeoAdminMobile.ux/SwissSearchMobile.js 2010-11-28 04:59:23 UTC (rev 2498)
@@ -0,0 +1,79 @@
+Ext.namespace("GeoAdminMobile.ux");
+
+GeoAdminMobile.ux.SwissSearchMobile = Ext.extend(Ext.form.Search, {
+ map: null,
+ name: 'swisssearch',
+ placeHolder: 'Search location...',
+ popup: null,
+ initComponent: function() {
+ var that = this;
+ this.on({
+ keyup: function(field, e) {
+ var key = e.browserEvent.keyCode;
+ if (key === 13 || key === 10) {
+ field.blur();
+ Ext.util.JSONP.request({
+ url: 'http://api.geo.admin.ch/swisssearch?lang=fr&query=lausanne&cb=Ext.util.JSONP.callback',
+ callbackKey: 'cb',
+ params: {
+ lang: 'de',
+ query: field.fieldEl.dom.value,
+ cb: 'Ext.util.JSONP.callback'
+ },
+ callback: function(result) {
+ Ext.regModel('swisssearch', {
+ fields: [
+ {
+ name: 'label',
+ type: 'string'
+ }
+ ]
+ });
+ if (result.results[0]) {
+ var store = new Ext.data.Store({
+ model: 'swisssearch',
+ data: result.results
+ });
+
+ var list = new Ext.List({
+ itemTpl : '{label}',
+ store: store,
+ listeners: {
+ selectionchange: function(selectionModel, records) {
+ alert('Not implemented: map recenter to: ' + records[0].data.bbox);
+ that.popup.hide();
+ }
+ }
+ });
+
+ if (this.popup) {
+ delete that.popup;
+ }
+ that.popup = new Ext.Panel({
+ floating: true,
+ modal: true,
+ centered: true,
+ width: 250,
+ height: 250,
+ scroll: 'both',
+ dockedItems: [
+ {
+ dock : 'top',
+ xtype: 'toolbar',
+ title: 'Search results'
+ }
+ ],
+ items: [
+ list
+ ]});
+ that.popup.show();
+ }
+ }
+ });
+ }
+ },
+ scope : this
+ })
+ }
+
+});
\ No newline at end of file
More information about the Commits
mailing list