AnsweredAssumed Answered

How to set a result of a query in a dgrid's memory store in a module

Question asked by lingpri on Jan 15, 2016
Latest reply on Jan 17, 2016 by Girish.Yadav

I have a AMD module, which has a public function, to load a feature layer and when the results return I need to populate a grid. I'm having trouble with scope accessing the grid craeted in a private method. I 'm trying to use this.set and watch on the object change , but calling "this.set" gives me a Type error. Please advise, I'm new to dojo framework.

 

 

 

          //Constructor function

          constructor: function (options, srcRefNode) {

 

                // results holder

                this.set("results", []);

                // watch updates of public properties and update the widget accordingly

                this.watch("results", this._updateMemoryStore);

            },

 

 

            // Update geocoder nodes

                _updateMemoryStore: function () {

                   var items =  this.get("results");

                     //idProperty must be set manually if value is something other than 'id'

                    var memStore = new Memory({

                        data: items,

                        idProperty: "ObjectID"

                    });

                    console.log(memStore);

            },

 

 

          onLoadBndry: function() {

                     ...

                    ...

                    queryTask.disableClientCaching = true;

                    queryTask.useAMF = false;

                    queryTask.showBusyCursor = true;

                    queryTask.execute(query,this._showResults);

 

 

                },

 

 

                _showResults:function(featureSet) {

                    console.log("_showResults");

                     var items = array.map(featureSet.features, function(feature) {

                        return feature.attributes;

                    });

                    this.set("results", items); \\TypeError: this.set is not a function

 

 

                },

Outcomes