Skip to content

Instantly share code, notes, and snippets.

@Franc-Brs
Created September 9, 2021 14:30
Show Gist options
  • Save Franc-Brs/7d54914a998ada2e3f43153c58a86b8b to your computer and use it in GitHub Desktop.
Save Franc-Brs/7d54914a998ada2e3f43153c58a86b8b to your computer and use it in GitHub Desktop.
lizmap_js
//Francesco Bursi, 10 th July 2021
//Short script to activate a layer when the user choose (if it's possible) to activate the layer in the layer-tree,
//is it's not visible on the map. So when you click on "dettagli".
lizMap.events.on({
'uicreated': function(e) {
$('#attribute-layer-list-table').find('tr').find('td').find('button').click( function(){
//storing the class of the checkbox in the check_class variable, it takes the name from the pushed button
var check_class = $(`#layer-${$(this).val()} > td:nth-child(1) > button`);
if (check_class.attr('class')!= "btn checkbox checked"){
check_class.trigger('click');
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment