[OpenLayers-Users] Re: need a little help with this ( user input & wfsprotocol.read )

Diego M. oo_O2_oo at hotmail.com
Wed Feb 15 03:46:56 EST 2012


*Thanks that really help!
then I wrote an alert message before filter block and i found out that it
did read what i submetted successfully.
So, either the issue is the filtering itself, or the processTheQuery
function.
coz I had nothing when I write alert message inside it. also all features
comes back.
it seems like that it doesn't call processTheQuery at all*

function doSearch()
	{
	
var value1 = document.getElementById('searchText');
var value2 = value1.value
*alert(value2);*
 filter = new OpenLayers.Filter.Logical({
    type: OpenLayers.Filter.Logical.OR,
    filters: [
	 new OpenLayers.Filter.Comparison({
            type: OpenLayers.Filter.Comparison.LIKE,
            property: "name",
            value: value2
        }),
		new OpenLayers.Filter.Comparison({
            type: OpenLayers.Filter.Comparison.LIKE,
            property: "mmsi",
            value: value1.value
        })
		 ]
});

wfsProtocol.read ({ 

             filter:filter,
         			 
             callback: processTheQuery, 
             scope: strategy
         });
	
		}
		
function processTheQuery(request) {
*alert('test function');*
     if (request.data && request.data.bbox) { 
           var b = request.data.bbox; 
           sExt = new OpenLayers.Bounds(b[0],b[1],b[2],b[3]); 
     }else { 
           var fts = request.features; 
           if (fts.length>0) { 
               sExt = fts[0].geometry.getBounds().clone(); 
               for(var i=1;i<fts.length;i++) { 
                  sExt.extend(fts[i].geometry.getBounds()); 
               } 
           } 
     } 
     vessels.destroyFeatures(); // get rid of values from previous call 
	 
   // any other process of the returned features goes here eg display
attributes in a popup 
     vessels.addFeatures(request.features); 
	 //map.addLayer(vessels);
   map.zoomToExtent(sExt); 
} 

&lt;b>I also tried callback: processTheQuery(response), but still no luck*

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/need-a-little-help-with-this-user-input-wfsprotocol-read-tp4468479p4471335.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list