I am trying to set the interactivity on a sublayer that I created on CartoDB web interface so that my events and tooltips receive the correct fields as arguments of the callback functions. Here is how I have tried to do this:

    poverty_layer = layers[1].getSubLayer(0)
    poverty_layer.set("interactivity", ["cartodb_id, namelsad10, hh_median"])

    poverty_layer.on "featureOver", (e,ll,pos,data)->
      console.log data

I assumed that by doing this I would see three data fields –– cartodb_id, namelsad10, and hh_median –– but I only see cartodb_id. I already managed to set interactivity successfully on sublayers that are created on the clientside. This is the one use case where it hasn't been successful.

1 Answer 1


The proper syntax apparently is as follows:

poverty_layer.setInteractivity("field1, field2, field3")

Or alternatively:

poverty_layer.set({interactivity: "field1, field2, field3"})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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