j-Children
The component renders draggable items as a tree without the possibility of collapsing. Data-Source must be Object Array in the form: { id: String, children: [ ], YOUR PROPERTIES }, { ... }
Configuration:
empty {String}an empty text (default:null)onchange {String}optional, a link to thefunction(arr)- captures items when resorted
Template:
{{ level }} contains a level (number)
{{ value }} contains an item (object)Try to understand the functionality from the example.
Good to know:
component.items {Object}contains all references of all items in the formitems[item.id] = itemcomponent.parents {Object}contains all references of all parents in the formparents[item.id] = parent
Use it with <ui-component name="children">. When the component is not loaded yet, jComponent downloads it on first use from the address in DEF.fallback (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.
<ui-component name="children" path="mynav">
<script type="text/html">
<div style="background:#F0F0F0;padding:8px;border-radius:var(--radius);margin-bottom:2px;margin-left:{{ level * 30 }}px">{{ value.name }}</div>
</script>
</ui-component>
<script>
var mynav = [{ id: '1', name: 'Level 1', children: [{ id: '1-1', name: 'Level 1-1' }, { id: '1-2', name: 'Level 1-2', children: [{ id: '1-2-1', name: 'Level 1-2-1' }, { id: '1-2-2', name: 'Level 1-2-2' }, { id: '1-2-3', name: 'Level 1-2-3' }] }] }, { id: '2', name: 'Level 2' }];
</script>