AnsweredAssumed Answered

Issues with creating a definitionExpression ArcGIS API for Javascript

Question asked by JTTodd on May 22, 2017
Latest reply on May 24, 2017 by rscheitlin

I am having issues setting a definitionExpression based on OnDemandGrid row selection with ArcGIS API for Javascript. I keep getting an error stating that definitionExpression is not a function and I don't understand why. Below is my code:

var selectedRows = [];
          grid.on('dgrid-select', function (event) {
              var stateName = event.rows[0].data.stateName;
              var rows = event.rows;
              for (i = 0; i < rows.length; i++) {
                  selectedRows.push(stateName);
              }

              for (i = 0; i < selectedRows.length; i++) {
                  stateLayer.definitionExpression('STATE_NAME = "' + i + '"');
              }
              console.log(selectedRows);
          });

Outcomes