<div dir="ltr"><div><div><div>Hi!<br><br></div>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:<br>
<br><br> Ext.onReady(function() {<br> Ext.state.Manager.setProvider(new Ext.state.CookieProvider());<br> <br> var ctrl, toolbarItems = [], action, actions = {};<br> action = new GeoExt.Action({<br>
control: Ext.Ajax.request({<br> type: 'GET',<br> url : 'test/',<br> success: function(response, opts) {<br>
var obj = Ext.decode(response.responseText);<br> console.dir(obj);<br> },<br> failure: function(response, opts) {<br>
console.log('server-side failure with status code ' + response.status);<br> }<br> }),<br> map: map,<br>
text: "max extent",<br> tooltip: "zoom to max extent"<br> });<br> toolbarItems.push(action);<br><br> new Ext.Window({<br> title: "Layer",<br>
height: 800,<br> width: 1000,<br> items: [{<br> xtype: "gx_mappanel",<br> map: map,<br> center: map.center,<br> zoom: map.zoom,<br>
tbar: toolbarItems<br> }]<br> }).show();<br><br><br></div>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?<br>
<br>Thank you,<br></div>Max Demars<br clear="all"><div><div><div><div><br>-- <br><div dir="ltr"><div><div><div>Stack Overflow: <a href="http://stackoverflow.com/users/1914034/burton449">http://stackoverflow.com/users/1914034/burton449</a><br>
</div></div>GIS Overflow: <a href="http://gis.stackexchange.com/users/14426/burton449">http://gis.stackexchange.com/users/14426/burton449</a><br></div>LastFm: <a href="http://www.lastfm.fr/user/burton449">http://www.lastfm.fr/user/burton449</a><br>
</div>
</div></div></div></div></div>