Hi,
I am using find task Show find task results in a DataGrid | ArcGIS API for JavaScript to display my data in the grid. But since user may not be aware about exact names of the attributes he want to enter data like a* or a% or a/ which should display the data as all data starting with a.
Any suggestion how to achieve this functionality will be helpful
Thanks
Aditya Kumar
Aditya,
See this help doc about the contains parameter:
FindParameters | API Reference | ArcGIS API for JavaScript | Contains
Hi Robert,
I am sorry but it didnt helped me much .
In the example as I mentioned earlier suppose I change the default search value from Katz to Ka* it should display all values having Ka.
Any idea on this?
Thanks
Aditya Kumar
Aditya,
I think that you issue is that you are thinking that you need to type a wild card character like * but the find task already does this behind the scenes.
The contains parameter determines whether to look for an exact match of the search text or not. If true, searches for a value that contains the searchText provided. This is a case-insensitive search. If false, searches for an exact match of the searchText string. The exact match is case-sensitive.
When I type "Ka" in the input box I get: Kathy Stricof and Allen Katz and M Kantor-treasurer. Notice I did not have to type "Ka*"
Hi Robert,
Thanks for the reply. The point mentioned by you is correct but in this case one more issue is there i.e if I type KA instead of getting the name starting with ka its giving me results which all contain the word.
Is there any way if I put KA it should give me only values that we start with KA.
Thanks
Aditya Kumar
Then you set contains to false.
Hi Robert,
I tried to execute in this way.
map.on("load", function () {
//Create the find parameters
findParams = new FindParameters();
findParams.contains = false;
findParams.returnGeometry = true;
findParams.layerIds = [0];
findParams.searchFields = ["OWNERNME1"];
findParams.outSpatialReference = map.spatialReference;
console.log("find sr: ", findParams.outSpatialReference);
});
Please let me know if the codes are fine because I am not getting the desired results.