How do I build more than 1 drop-down selector menu on the same table/layer in Google Fusion Table?

梦想的初衷 提交于 2019-11-29 17:40:48

Well issue one is being able to retrieve values from your select lists. I give all my select lists an id and use jQuery.js to access those values using:

var value = $('#program_select_id').val();

Second is chaining your query conditions via ' AND ' which your code already seems to grasp.

Here's an example of some jQuery dependent code that I use:

<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script> 

<script type="text/javascript">

function setQuery(ft_layer, current_table_id, location_col)
{
    var query = [];

    var value = $('#program_select_id').val();
    if(value !== ''){
        query.push("'program' = '" +  value + "'");
    }
    value = $('#provider_select_id').val();
    if(value !== ''){
        query.push("'data_provider' = '" +  value + "'");
    }
    value = $('#observable_select_id').val();
    if(value !== ''){
        query.push("observables CONTAINS '" + value + "'");
    }

    var where = query.join(' AND ');

    var qryOpts = {
      query: {
        select: location_col,
        from: current_table_id,
        where: where
      }
    };
    ft_layer.setOptions(qryOpts);
}

</script>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!