var ds1=''; var ds2=''; var but; var search; Ext.onReady(function(){ ds = new Ext.data.JsonStore({ root: 'addresslist', fields: ['address','longitude','latitude','type'], proxy : new Ext.data.HttpProxy({ method: 'GET', url: 'http://'+document.location.host+'/intiendols/search' }) }); ds1=','; ds2='15'; ds.on('beforeload', function(s) { s.setBaseParam('q', ds1); s.setBaseParam('limit', ds2); }); ds.load(); search = new Ext.form.ComboBox({ store: ds, typeAhead: false, loadingText: 'Searching...', width: 570, pageSize:0, hideTrigger:true, applyTo: 'search', triggerAction : 'none', enableKeyEvents : true, mode : 'remote', minChars:255, listeners: { specialkey: function(f,e){ if (e.getKey() == e.ENTER) { s1=f.getValue().toString(); this.s2='15'; storeResults.load({ //params : {action: 2}, callback: function(records, options, success){ if (records.length == 1){ var geocodeMatchCode = records[0].data.type; if (geocodeMatchCode == 0){ zoomToPoint(geocodeMatchCode,records[0].data.longitude,records[0].data.latitude,records[0].data.address); } else if (geocodeMatchCode == 1 || geocodeMatchCode == 2 || geocodeMatchCode == 3 || geocodeMatchCode == 4 || geocodeMatchCode == 5 || geocodeMatchCode == 6 || geocodeMatchCode == 7){ zoomToPoint(geocodeMatchCode,records[0].data.longitude,records[0].data.latitude); } } } }); } } } }); but =new Ext.Button({ defaultType: 'button', renderTo : 'btn', text: 'SEARCH', handler: btn_search_handler }); }); var btn_search_handler = function(button, event) { //alert('this.btn1Text=' + search.value); s1=search.value; s2='15'; //storeResults.load(); storeResults.load({ callback: function(records, options, success){ if (records.length == 1){ var geocodeMatchCode = records[0].data.geocodeMatchCode; if (geocodeMatchCode == 0){ zoomToPoint(geocodeMatchCode,records[0].data.longitude,records[0].data.latitude,records[0].data.address); } else if (geocodeMatchCode == 1 || geocodeMatchCode == 2 || geocodeMatchCode == 3 || geocodeMatchCode == 4 || geocodeMatchCode == 5 || geocodeMatchCode == 6 || geocodeMatchCode == 7){ zoomToPoint(geocodeMatchCode,records[0].data.longitude,records[0].data.latitude); } } } }); }