Query feature table and feature layer (map) at same time

1883
3
Jump to solution
02-27-2017 04:34 AM
AndréRibeiro
New Contributor II

I have a feature table like this example (ArcGIS API for JavaScript Sandbox). What I did is a filter to the table with differents queries like date or strings, and they are working good!

If I search for a date interval the feature table refresh and show only the records that is between that dates. What I want now is that the records on map refresh too, but I can't do that... Someone can help me please?

Example:

I filter the table

Only one record with this query

But the map contains all records yet and didn't refresh

Code:

HTML

<input id="nud" type="text" data-dojo-type="dijit/form/TextBox" data-dojo-props="trim:true, intermediateChanges:true" class="dijit-form-TextBox filterTb" />
<button type="button" id="confirm">Filtrar</button>

Javascript

var confirmar = dom.byId("confirm");
on(confirmar, "click", function(value){
              var userVal = dijit.byId("nud").get('value');  
              var oidFld = myFeatureLayer.objectIdField;  
              var query = new Query(); 
              lastWhere = query.where = "nud LIKE '%" +  userVal + "%'";
                
            myFeatureLayer.queryIds(query, lang.hitch(this, function(objectIds) {  
               myFeatureTable.selectedRowIds = objectIds;  
               myFeatureTable._showSelectedRecords();
               }));  
});     

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

André,

   You can just take the lastWhere and apply it to the myFeatureLayer definition Expression:

myFeatureLayer.setDefinitionExpression(lastWhere);


View solution in original post

3 Replies
RobertScheitlin__GISP
MVP Emeritus

André,

   You can just take the lastWhere and apply it to the myFeatureLayer definition Expression:

myFeatureLayer.setDefinitionExpression(lastWhere);


AndréRibeiro
New Contributor II

Work like a charm! Thank you!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Don't forget to mark this question as answered by clicking on the "Correct Answer" link on the reply that answered your question.