Add jsTree for optional layers

This commit is contained in:
Norbert Renner 2019-01-11 11:03:18 +01:00
parent 8b46ba9a27
commit ddbbd00d1f
5 changed files with 76 additions and 4 deletions

View file

@ -3,6 +3,55 @@ BR.LayersTab = L.Control.Layers.extend({
this._map = map;
this.onAdd(map);
L.DomUtil.get('layers-control-wrapper').appendChild(this._form);
$('#optional-layers-tree')
.on('select_node.jstree', function (e, data) {
//console.log('selected: ', data);
console.log('selected: ' + data.node.text);
})
.on('check_node.jstree', function (e, data) {
//console.log('selected: ', data);
console.log('checked: ' + data.node.text);
})
.on('uncheck_node.jstree', function (e, data) {
//console.log('selected: ', data);
console.log('unchecked: ' + data.node.text);
})
.jstree({
plugins: [ 'checkbox' ],
checkbox: {
whole_node: false,
tie_selection: false
},
core: {
'themes': {
'icons': false,
dots : false
},
'data' : [
{
text: 'Simple root node',
'state' : {
'disabled' : true
},
'children' : [
'Child 1'
]
},
{
'text' : 'Root node 2',
'state' : {
'opened' : true,
//'selected' : true
'disabled' : true
},
'children' : [
{ 'text' : 'Child 1' },
'Child 2'
]
}
]
}
});
return this;
}
});