hello,
I'm having trouble porting over this small piece of code that performs a google geocode request in an extended ComboBox (from GeoExt). In Ext JS 3.4 this works perfectly:
PHP Code:
var geocoder = new google.maps.Geocoder();
PHP Code:
.....
.....
tbar: [{
xtype: "gx_geocodercombo",
width: 250,
layer: locationLayer,
displayField: "formatted_address",
store: new Ext.data.JsonStore({
root: null,
fields: [
"formatted_address",
{name: "lonlat", convert: function(v, rec) {
var latLng = rec.geometry.location;
return [latLng.lng(), latLng.lat()];
}},
{name: "bounds", convert: function(v, rec) {
var ne = rec.geometry.viewport.getNorthEast(),
sw = rec.geometry.viewport.getSouthWest();
return [sw.lng(), sw.lat(), ne.lng(), ne.lat()];
}}
],
proxy: new (Ext.extend(Ext.data.DataProxy, {
doRequest: function(action, rs, params, reader, callback, scope, options) {
geocoder.geocode({address: operation.params.q}, function(results, status) {
var readerResult = reader.readRecords(results);
console.log(readerResult);
callback.call(scope, readerResult, options, !!readerResult);
});
}
}))({api: {read: true}})
})
}]
In 4.1 Ext.data.DataProxy is gone so I was trying this using Ext.data.proxy.Ajax:
PHP Code:
proxy: new (Ext.extend(Ext.data.proxy.Ajax, {
doRequest: function(operation, callback, scope) {
geocoder.geocode({address: operation.params.q}, function(results, status) {
var readerResult = scope.proxy.reader.readRecords(results);
console.log(readerResult);
callback.call(scope, readerResult, options, !!readerResult);
});
}
}))({api: {read: true}})
})
readerResult returns a constructor containing the correct json but I'm also getting the error:
PHP Code:
Uncaught TypeError: Object [object Object] has no method 'getResultSet' Store.js 1148
Any idea what I'm doing wrong? I am totally on the wrong track here?
Thanks in advance.