I would like to add multiple sublayers of the same table attached to a single layeraction in cartodb js. I written my webpage based on the following cartodb tutorial: http://docs.cartodb.com/tutorials/toggle_map_view.html. Essentially I would like to attach more than a single query to each button, something where you would populate sublayers[0] and [1] perhaps? Does anyone now how to do this?
var LayerActions = {
all: function(){
sublayers[0].setSQL("SELECT * FROM ne_10m_populated_places_simple");
return true;
},
capitals: function(){
sublayers[0].setSQL("SELECT * FROM ne_10m_populated_places_simple WHERE featurecla = 'Admin-0 capital'");
return true;
},
megacities: function(){
sublayers[0].setSQL("SELECT * FROM ne_10m_populated_places_simple WHERE megacity = 1");
return true;
}
}