VinayBa and Feature Layer snapshot mode

Discussion created by VinayBa on Feb 10, 2014
Latest reply on Feb 12, 2014 by tligon
HI All,

  I am facing issue where my graphic object is getting removed from map .I am using world map and adding feature layer in snap shot mode.
I dont want to hit server again and again so hence i am keeping all featuer layer gaphics in dojo dictionary using below code

 dojo.forEach(, function(graphic){
                hashMap.add(graphic.attributes.CNTRY_NAME, graphic);

now when i want to highlight a country i do below .

if (hashMap.containsKey(country)) {
                                  var graphic = hashMap.item(country);

I also have onClick functionality in my app.

SO lets say onload of page i have to highlight somecountries lets India,USA,UK etc.

now in some scenarios i have to clear these countries i.e i have to deHighlight them so i use below code

if ( != null) {;

I have defined my onClick function as below

handle=dojo.connect(map, "onClick", function(e){

function selectCountries(e){
  var graphic = evt.graphic;
        var countryName = graphic.attributes.CNTRY_NAME;

Now when user clicks on India,USA,UK i get below error
evt.graphic is undefined

so my graphic object is lost when i use;

how to overcome this.