[Users] Ajax request in geoExt toolbar
Max Demars
burton449geo at gmail.com
Tue Jan 7 15:39:18 CET 2014
Hi!
I have problem creating a button in a toolbar over a map that will made an
ajax request. I havent find a GeoExt ajax class so I am trying to use the
Ext.Ajax.request inside a GeoExt.Action like this:
Ext.onReady(function() {
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
var ctrl, toolbarItems = [], action, actions = {};
action = new GeoExt.Action({
control: Ext.Ajax.request({
type: 'GET',
url : 'test/',
success: function(response, opts) {
var obj =
Ext.decode(response.responseText);
console.dir(obj);
},
failure: function(response, opts) {
console.log('server-side failure with
status code ' + response.status);
}
}),
map: map,
text: "max extent",
tooltip: "zoom to max extent"
});
toolbarItems.push(action);
new Ext.Window({
title: "Layer",
height: 800,
width: 1000,
items: [{
xtype: "gx_mappanel",
map: map,
center: map.center,
zoom: map.zoom,
tbar: toolbarItems
}]
}).show();
I see that the request is automatically performed when the page is
refreshed, but the map do not load correctly. What is the proper way to
achieve that?
Thank you,
Max Demars
--
Stack Overflow: http://stackoverflow.com/users/1914034/burton449
GIS Overflow: http://gis.stackexchange.com/users/14426/burton449
LastFm: http://www.lastfm.fr/user/burton449
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20140107/ec6574bf/attachment.html
More information about the Users
mailing list