Skip to content

Commit

Permalink
Use the layer's sql if available
Browse files Browse the repository at this point in the history
Partial fix to CartoDB#205. Attempt to use the layer's sql in its options, if this
fails create the sql statement as it was previously.
  • Loading branch information
ebrelsford committed Dec 9, 2015
1 parent 59e194e commit a477756
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion sandbox/scroll.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@
layer_name = layer.layers[0].options.layer_name,
filter = actions.global.cartodb_filter ? " WHERE "+actions.global.cartodb_filter : "";

sublayer.setSQL("SELECT * FROM "+layer_name+filter)
var sql = layer.layers[0].options.sql;
if (!sql) {
sql = "SELECT * FROM "+layer_name+filter;
}
sublayer.setSQL(sql);

self.map.addLayer(layer);

Expand Down
6 changes: 5 additions & 1 deletion sandbox/slides.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,11 @@
layer_name = layer.layers[0].options.layer_name,
filter = actions.global.cartodb_filter ? " WHERE "+actions.global.cartodb_filter : "";

sublayer.setSQL("SELECT * FROM "+layer_name+filter)
var sql = layer.layers[0].options.sql;
if (!sql) {
sql = "SELECT * FROM "+layer_name+filter;
}
sublayer.setSQL(sql);

self.map.addLayer(layer);

Expand Down

0 comments on commit a477756

Please sign in to comment.