<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">This question has nothing to do with GeoExt, but is a plain Ext question.<div><br></div><div>Just use a normal Ext button with a handler that fires Ext.Ajax.request. No need for GeoExt.Action here.</div><div><br></div><div>Best regards,</div><div>Bart</div><div><br><div>
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">--</div><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Bart van den Eijnden<br>Front-end Developer | Boundless<br>@boundlessgeo</div>
</div>
<br><div><div>On 07 Jan 2014, at 15:39, Max Demars <<a href="mailto:burton449geo@gmail.com">burton449geo@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><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><br>-- <br><div dir="ltr"><div><div>Stack Overflow: <a href="http://stackoverflow.com/users/1914034/burton449">http://stackoverflow.com/users/1914034/burton449</a><br>
</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>
_______________________________________________<br>Users mailing list<br><a href="mailto:Users@geoext.org">Users@geoext.org</a><br>http://www.geoext.org/cgi-bin/mailman/listinfo/users<br></blockquote></div><br></div></body></html>