arcgis - dijit/form/select to select search fields in Arc JS API -


i'm brand new javascript, dojo , html , i've searched everywhere examples of , cannot find any.

i have map feature points , find task highlight feature points on map, , display them in grid it's field attributes. works great when specify search field as:

findparams.searchfields = ["location"]; 

but if add:

findparams.searchfields = ["location", "model_num"]; 

the grid displays results multiple fields (ie. searching attributes in location "a" find attributes in model_num containing letter "a"). decided add drop down menu select specify field search in (one @ time) results more precise.

so added following dijit:

<select id="fieldselect" data-dojo-type="dijit/form/select" name="fieldselect">           <option value="" selected="selected">select field</option>           <option value="model_num">model number</option>           <option value="location">location</option>           <option value="num_deficiencies">number of deficiencies</option>           <option value="install_date">install date</option> </select> 

i modified search field statement to:

findparams.searchfields = "[" + "\"" + dom.byid("fieldselect").value + "\"" + "]"; 

when click search button uncaught typeerror: a.join not function (findparameters.js:5)

i hope enough information. have solution or recommendation?

update

after suggestion pass array , not string findparams.searchfields, made following changes:

findparams.searchfields = [];   findparmas.searchfields.push(dom.byid("fieldselect").value); 

this still gave me attribute results multiple fields. after running couple small tests:

var selectedfield = document.getelementbyid('fieldselect').value; var index = selectedfield.options[selectedfield.selectedindex].value; 

and:

var selectedfield = dom.byid('fieldselect').value; 

i'm finding in chrome developer tools debugger, when created breakpoint @ line , executed statement, both examples had value of selectedfield 'undefined'.

is issue of not getting value drop down select dijit?

if no value passed findparams.searchfields, api assumes fields valid, why i'm getting attribute results multiple fields.

thanks.

use dijit.byid instead of dom.byid.

the following works me:

var value = dijit.byid("fieldselect").value; if ("" != value) {   findparams.searchfields = [value]; } else {   findparams.searchfields = ["model_num", "location", "num_deficiencies", "install_date"]; } 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -