AnsweredAssumed Answered

Using dojo FilteringSelect for text autocomplete

Question asked by gschwitz on Oct 28, 2013
Latest reply on Oct 28, 2013 by evtguy
I am trying to implement text autocompleting within a dijit.form.FilteringSelect.  I have set up my query to return the appropriate values.  I have created a new mem store that is being populated correctly.  The issue I am running into is that the available names are not populating when the application is loaded.  I am getting "TypeError: a[this.searchAttr] is undefined" thrown back in firebug when I click on the dropdown arrow.  I have removed the query task URL since it is internal only.  Any assistance is appreciated.

Thanks,
Geoff

Here is my code:
      var queryTaskName = new esri.tasks.QueryTask("");                 //create an array                                 var locNames = [];                 locNamesMemory = new Memory({ data: locNames, idProperty: "NAME" });                 //build query filter                 var queryName = new esri.tasks.Query();                 queryName.returnGeometry = false;                 queryName.outFields = ["OBJECTID","NAME"];                 queryName.where = "OBJECTID > 0";                 queryName.returnGeometry = false;                 queryTaskName.execute(query, function (results) {                     //parse results and add to autocomplete widget                     dojo.forEach(results.features, function (value, index) {                         locNames.push(value.attributes.NAME);                     });                 }, function (error) {                     alert("Error: " + error);                 });                  var filteringSelect = new FilteringSelect({                     id: "txtSearch",                     name: "state",                     value: "Enter Name Here",                     store: locNamesMemory,                     autoComplete: true,                     searchAttr: ["NAME"]                 }, "txtSearch");

[HTML]<input id="txtSearch" type="text"  placeholder="Enter Name Here" >[/HTML]

Outcomes