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?


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

  [var clayer = new esri.layers.GraphicsLayer();  

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?

  • 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
    Commented Sep 5, 2015 at 16:11
  • @GavinR, Thanks for reminding, Post has been updated
    – Suffii
    Commented Sep 5, 2015 at 19:21

1 Answer 1


The code you have, namely:


.. 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() {
  • 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
    Commented Sep 5, 2015 at 22:51

Your Answer

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

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