select marker symbol and change it dynamically

778
5
03-31-2020 12:36 AM
rsharma
Occasional Contributor III

Query: How to change marker symbol dynamically programatically on graphics layer

0 Kudos
5 Replies
rsharma
Occasional Contributor III

Hi I tried to change it by accessing its url.

 point_url = cloneGra.symbol.__accessor__.store._values.url;

and tried to change the symbol point_url in l while saving that marker, but it do not change.????

Do anyone know how to change symbol of individual marker

1 when we click on that marker,

2 define a marker type in textbox  save it and

3 change its symbol.

 var pointurl = funurl(mtype);
        point_url.url = pointurl;

        console.log(point_url.url);

It return perfect url but do not chnge marker symbol instantly i have to zoom in or zoomout  that map then the markers change???

Plus when i again change the same marker it do not chnage symbol

0 Kudos
rsharma
Occasional Contributor III

Hi after so many efforts my markersymbol changed but it only changed when i zoom in or out map after that. i called my event in view.when and in require function but it do not change instantly.

Is their any other way to do it.

Thanks in advance, this is my code below

 point_url = cloneGra.symbol.__accessor__.store._values;

                    //save marker button
           jQuery('#main').on('click','.savemarker',function(e){
              var points_arr=[];
              var markertype = jQuery(this).parents().find('.dropdownbtn').html();
              var comment = jQuery(this).parents().find('.write_comment').val();
              var tempoint = changedMarkerSymbol(markertype);//passing type of marker to this function
                point_url.url = tempoint;//tempoint contain new url
              points_arr={'x' : point_x_coordinate , 'y' : point_y_coordinate};
                 jQuery.ajax({
                                 //send ajax call to save data
                                    success: function(data){
                                      }
                                    });

            view.popup.close();

            });//End Save marker

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Rajni,

  The simple solution is to remove that graphic and re-add it with the new symbology.

0 Kudos
rsharma
Occasional Contributor III

Hi Robert Scheitlin, GISP

I am changing marker symbol url here

//This is tempgraphics function

  markerGL.add(cloneGra);
   point_url = cloneGra.symbol.__accessor__.store._values;
            }//End If
           }//End addTempGraphics

//On button save click

 point_url = cloneGra.symbol.__accessor__.store._values;

var tempoint = changedMarkerSymbol(markertype);//passing type of marker to this function and it return new symbol url
                point_url.url = tempoint;//tempoint contain new url

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

That not what I suggested

0 Kudos