[OpenLayers-Users] How can I overwrite the url ofOpenLayers.Protocol.HTTP?

Gery . gamejihou at hotmail.com
Mon Feb 4 01:42:44 PST 2013


Hi Arnd,

Thanks for the answer and the tip, I tried it but with GeoExt.form.formPanel didn't work, I will take the protocol out of this formPanel and will try that. Without testing it I think it should be a scope problem, because the .refresh({}); function will be calling the protocol which is outside the listeners function, but will try it.

Any other suggestions are very welcome, thanks

Gery
__________________________________________________________________________________________
Piensa en el medio ambiente - mantenlo en la pantalla. NO lo imprimas si NO es necesario.
Think green - keep it on the screen. Do NOT print if it is NOT necessary.
Denken Sie an die Umwelt - bewahren Sie es auf dem Bildschirm. Drucken Sie es NICHT, wenn es NICHT notwendig ist.


From: arnd.wippermann at web.de
To: gamejihou at hotmail.com
CC: openlayers-users at lists.osgeo.org
Subject: AW: [OpenLayers-Users] How can I overwrite the url ofOpenLayers.Protocol.HTTP?
Date: Sun, 3 Feb 2013 18:23:05 +0100








Hi Gery,
 
this is the way without GeoExt :
myVectorLayer.refresh({url: newUrl});
http://permalink.gmane.org/gmane.comp.gis.openlayers.user/16902
 
Arnd
 


Von: openlayers-users-bounces at lists.osgeo.org 
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Gery 
.
Gesendet: Samstag, 2. Februar 2013 19:06
An: 
openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] How can I 
overwrite the url ofOpenLayers.Protocol.HTTP?



Hi 
all,

How can I overwrite the url of OpenLayers.Protocol.HTTP? I tried 


> searchformPanel.protocol.url

and it works (checked with 
console.log), but at the end the original url is sent (in the code below: url: 
'/fs/') (see attached picture).

![output from firebug][1]

This is 
the code: 

    var searchformPanel = new 
GeoExt.form.FormPanel({
      border: 
false,
      width: 
250,
      protocol: new 
OpenLayers.Protocol.HTTP({
        url: 
'/fs/',
        format: new 
OpenLayers.Format.GeoJSON()
      
}),
      
items:[{
        xtype: 
'combo',
        id: 
'idcombo',
        store: new 
Ext.data.SimpleStore({
          
fields:['fsclass','ollayer'],
          
data:[["Boreholes","Boreholes"],["All_layers","All 
layers"]]
        
}),
        displayField: 
'ollayer',
        valueField: 
'fsclass',
        fieldLabel: 
'Layer',
        emptyText: 'select a 
layer',
        submitValue: 
false,
        selectOnFocus: 
true,
        mode: 
'local',
        typeAhead: 
true,
        editable: 
false,
        forceSelection: 
true,
        triggerAction: 
'all'
      
},{
        xtype: 
'textfield',
        id: 
'idtextfield',
        fieldLabel: 'Find 
features',
        emptyText: 'enter 
word',
        name: 
'comments__like',
        allowBlank: 
false
      }],
      
listeners:{
        actioncomplete: 
function(form, 
action){
          
searchShowTip(action.response.features);
        
}
      },
      
buttons:[{
        text: 
'search',
        
listeners:{
          click: 
function(){

            
var comboLayer = 
Ext.getCmp('idcombo').getRawValue();
            
var keyword = 
Ext.getCmp('idtextfield').getRawValue();

            
var newUrl = '/fs/' + comboLayer + '?format=GeoJSON&comments__ilike=' + 
keyword + 
'&queryable=comments';
            
console.log('1:' + 
newUrl);

            
//this gets '/fs/' from the 
searchformPanel
            
console.log('2:' + 
searchformPanel.protocol.url);

            
searchformPanel.protocol.url = 
newUrl;
            
console.log('3:' + 
searchformPanel.protocol.url);

            
searchformPanel.search();
          
}
        
}
      }]
  });

Please any support 
about this is very welcome, thank you!

  [1]: 
http://i.stack.imgur.com/mY1pq.png

__________________________________________________________________________________________
Piensa 
en el medio ambiente - mantenlo en la pantalla. NO lo imprimas 
si NO es necesario.
Think green - keep it on the screen. Do NOT print if it is NOT 
necessary.
Denken Sie an die 
Umwelt - bewahren Sie es auf dem Bildschirm. Drucken Sie es 
NICHT, wenn es NICHT notwendig 
ist.
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130204/433dcdf1/attachment.html>


More information about the Users mailing list