Not used this plugin, but going to take a stab at it anyway.
I would advise that you make a more complex source, making use of the source: function(request, response){} feature. See more.
$("#txtSearch").autocomplete({
source: function(req, resp){
var results = [];
$.each(setoresComerciais.features.properties, function(k, p){
if(p.sco_dsc_loc.toLowerCase().indexOf(req.term.toLowerCase()) == 0){
results.push({
label: p.sco_num_sc + " - " + p.sco_dsc_loc,
value: p.sco_dsc_loc,
properties: p
});
}
});
resp(results);
},
select: function(event, ui){
map.fitBounds(stComerciaisLayer.getBounds(ui.item.value));
return false;
}
});
This will ensure that there is a { label, value } pair for each potential result. You can also access all the properties too via ui.item.properties in select if you like.
This will also mean that you are passing just "FORTALEZA" and not "1 - FORTALEZA" which may confuse the plugin if it does match a title in the map data.
If you had provided example data or a jsFiddle, I would have tested this solution.
Update
Did some more reading. I see:
fitBounds(<LatLngBounds> bounds, <fitBounds options> options?)
Sets a map view that contains the given geographical bounds with the maximum zoom level possible.
map.fitBounds([
[40.712, -74.227],
[40.774, -74.125]
]);
To me, it appears the function is expecting a array versus a String. This is something that is returned by .getBounds(). Yet nothing I read advises that .getBounds() does not accept input. So I do not think stComerciaisLayer.getBounds(ui.item.value) will return the value you want.
Note
You've selected a great answer, and just updating my code as an alternative.
$("#txtSearch").autocomplete({
source: function(req, resp){
var results = [];
$.each(setoresComerciais.features, function(k, f){
var props = f.properties;
if(props.sco_dsc_loc.toLowerCase().indexOf(req.term.toLowerCase()) == 0){
results.push({
label: props.sco_num_sc + " - " + props.sco_dsc_loc,
value: props.sco_dsc_loc,
properties: props,
id: k
});
}
});
resp(results);
},
select: function(event, ui){
var feature = setoresComerciais.features[ui.item.id];
var featureLayer = L.geoJSON(feature)
map.fitBounds(featureLayer.getBounds());
}
});