[OpenLayers-Users] How can I overwrite the url ofOpenLayers.Protocol.HTTP?
Arnd Wippermann
arnd.wippermann at web.de
Sun Feb 3 09:23:05 PST 2013
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/20130203/3e683a45/attachment.html>
More information about the Users
mailing list