From a4777563641e78a58c5ae1e03d27696eec383043 Mon Sep 17 00:00:00 2001 From: Eric Brelsford Date: Wed, 9 Dec 2015 10:31:10 -0500 Subject: [PATCH] Use the layer's sql if available Partial fix to #205. Attempt to use the layer's sql in its options, if this fails create the sql statement as it was previously. --- sandbox/scroll.html | 6 +++++- sandbox/slides.html | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sandbox/scroll.html b/sandbox/scroll.html index acdc8589..677db835 100644 --- a/sandbox/scroll.html +++ b/sandbox/scroll.html @@ -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); diff --git a/sandbox/slides.html b/sandbox/slides.html index 65180464..87274986 100644 --- a/sandbox/slides.html +++ b/sandbox/slides.html @@ -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);