j-Selection
The component supports something like checkbox list.
Configuration:
remember {Boolean}remembers selection when thedatasourceis changed (default:true)datasource {String}a path to the datasource (default: empty)key {String}anidentifierkey name for the datasource (default:id)attr {String}adata-[attr]for storing ofidentifier(default:id)selector {String}a jQuery selector for elements (default:.selection)class {String}selected class (default:selected)dblclickselectall {Boolean}enables reverse selection after double-click (default:true)cancel {String}a path to the variable (if the variable is changed then the selection is resetted, default: empty)- NEW:
click {String}a selector for capturing of click (default:.selection)
Methods:
component.selectall()selects all itemscomponent.selectnone()selects nonecomponent.selecttoggle()reverses selection
Use it with <ui-component name="selection">. 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.
<style>
.items > div { height: 28px; line-height: 28px; border-bottom: 1px solid #E0E0E0; }
.selection { width: 18px; height: 18px; font-size: 11px; border-radius: 3px; border: 1px solid #E0E0E0; text-align: center; float: left; cursor: pointer; margin: 4px 5px 0 0; }
.selection i { display: none; line-height: 16px; }
.selection.selected i { display: block; }
</style>
<ui-component name="selection" path="myselection" class="items m">
<div><span class="selection" data-id="1"><i class="ti ti-check"></i></span>Item 1</div>
<div><span class="selection" data-id="2"><i class="ti ti-check"></i></span>Item 2</div>
<div><span class="selection" data-id="3"><i class="ti ti-check"></i></span>Item 3</div>
<div><span class="selection" data-id="4"><i class="ti ti-check"></i></span>Item 4</div>
<div><span class="selection" data-id="5"><i class="ti ti-check"></i></span>Item 5</div>
<div><span class="selection" data-id="6"><i class="ti ti-check"></i></span>Item 6</div>
<div><span class="selection" data-id="7"><i class="ti ti-check"></i></span>Item 7</div>
<div><span class="selection" data-id="8"><i class="ti ti-check"></i></span>Item 8</div>
<div><span class="selection" data-id="9"><i class="ti ti-check"></i></span>Item 9</div>
</ui-component>
<div>Output: <code><ui-bind path="myselection" config="text:JSON.stringify(value)"></ui-bind></code></div>