[Users] Ajax request in geoExt toolbar

Bart van den Eijnden bartvde at boundlessgeo.com
Tue Jan 7 15:46:52 CET 2014


This question has nothing to do with GeoExt, but is a plain Ext question.

Just use a normal Ext button with a handler that fires Ext.Ajax.request. No need for GeoExt.Action here.

Best regards,
Bart

--
Bart van den Eijnden
Front-end Developer | Boundless
@boundlessgeo

On 07 Jan 2014, at 15:39, Max Demars <burton449geo at gmail.com> wrote:

> 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
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20140107/2bdcb21f/attachment.htm 


More information about the Users mailing list