I'm having some trouble using the selectFeatures
method with a feature layer. The code below builds a query using input text. If anyone has any pointers on what I could be doing wrong here, it'd be a huge help! I added a function to get some feedback after the selection is complete. It appears to be working fine when I test the search, but the results are not being displayed correctly.
//Query
var query = new Query();
searchButton.onclick=function(){
var value = dom.byId('searchText').value;
query.returnGeometry = true
query.where = '"Type"' + " LIKE '%" + value + "%'"
console.log('Query Registered');
roundabouts.selectFeatures(query,FeatureLayer.SELECTION_NEW, function(selection){
console.log('Selection Query: ' + query.where);
console.log(selection.length + ' Results Returned');
});
};
Best Answer
If I were writing this function I would structure it this way.
Also make sure you have the necessary modules imported and variables defined.
One final issue, is "selection.length" a method of the selection object that is returned? This may be why you are not seeing the desired results.