2

I followed This API Tutorial to create Cluster Points on the map. Now I would like to have a function to hide them. I already tried like?

clusterLayer.hide();  

but it didn't work! I also tried to bind the clusterLayer to a GraphicsLayer like below

  [var clayer = new esri.layers.GraphicsLayer();  
  clayer.add(clusterLayer);  
  clayer.hide();][1]  

but still not working After hours of working I find a sample on google at this Demo doing the job of switching between Points and Cluster but it is supper complicated to me! Can you please let me know how I can hide and show the cluster layer on demand?

2
  • Hi Behseini - I think you tried to link to a tutorial at the beginning of your question, but it seems like the link is missing - can you post the link to the tutorial you're trying to follow? Thanks!
    – GavinR
    Sep 5, 2015 at 16:11
  • @GavinR, Thanks for reminding, Post has been updated
    – Suffii
    Sep 5, 2015 at 19:21

1 Answer 1

1

The code you have, namely:

clusterLayer.hide();

.. should work! Here's an example (click the "hide" button I added - at the top): http://jsbin.com/qatihi/edit?html,js,output

Here is the code I added to the sample to make it work (in response to my button):

on(dom.byId("hide"), "click", function() {
    clusterLayer.hide();
}.bind(this));
1
  • Thanks a lot GavinR, I know why it wasnt working for me now! I think I was putting the clusterLayer.hide(); out of the scope of the clusterLayer. Thanks
    – Suffii
    Sep 5, 2015 at 22:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.