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

Gery . gamejihou at hotmail.com
Sat Feb 2 10:05:38 PST 2013


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/20130202/ff6d1d5c/attachment.html>


More information about the Users mailing list