I've been scratching my head over this and I'm wondering if this is possible. I want to replace the protocol of the GeoExt.form.FormPanel in the following way:
Since extjs, geoext, openlayers are javascript libraries, I've tried things such as "eval" to make the variable "proto" inside the handler accessible in the formpanel but no luck so far. Here it is a simplified example to show this:
var proto = null;
var formPanel = new GeoExt.form.FormPanel({
protocol: proto, # <--- replace with [1]
items: [{
xtype: "combo",
id: "idcombo",
etc...
}, {
xtype: "textfield",
id: "idtext",
etc...
}],
button:[{
text: "search",
handler: function() {
formPanel.search();
var combo = Ext.getCmp('idcombo').getValue(); # <--- this works and gets the value chosen in "xtype: combo"
var proto: new OpenLayers.Protocol.HTTP({ # <--- [1] (ie. new variable "proto")
url: "http://www.pub.pub/" + combo + "/somestuff/", # <--- this works
format: etc...
})
}
}]
})
how could I do this? I'll appreciate your support, thanks in advance.
Best regards,
Gery
The solution was to use only "protocol.options.url = newUrl;" instead of protocol.destroy(); or protocol.read();, a complete explanation is here