j-TreeView
Ten element jest tylko beta preview. jest nadal w trakcie budowy.
Konfiguracja:
parent {String}- pojemnik o stałej wysokości, może byćwindow. wartość domyślna: elementparent.visibleY {Boolean}wciąż wyświetla pasek skręcaniaY(default:true)movable {Boolean}umożliwia poruszanie się węzłów (default:true)cachexpand {Boolean}przypomina stan poprzedniego (default:true)arrows {Boolean}umożliwia strzałki dla folderów (default:true)expanded {Boolean}rozszerza wszystkie węzły (default:false)- Poziomy
autosort {Boolean}wedługitem.sort(jeśli istnieją) lubitem.name(jeżeli istnieją), wstępne:true margin {Number}górna / dolna marża razem (default:0)marginxs {Number}górna / dolna margina razem dla szerokości ekranuxsmarginsmgórna / dolna margina razem dla szerokości ekranusmmarginmdgórna / dolna margina razem dla szerokości ekranumdmarginlggórna / dolna margina razem dla szerokości ekranulgdisabled {Boolean}wyłącza cały składnik- Rodzice
parentselectable {Boolean}będą wybierani (default:true)
Struktura danych:
- Obiekt Array
- Obiekt musi zawierać
id:String, co jest głównym identyfikatorem każdego elementu. - Obiekt musi zawierać
name:Stringichildren:[another similar object]lubchildren:null(bez dzieci) - Obiekt musi zawierać
html:Stringjest renderowany jako treść (jeśli nie istnieje, tonamejest renderowane) - Element obiektu może zawierać
..., classname: 'css_custom_class' }, dodaje klasę CSS do elementu "label" - Obiekt element wspiera własność
actions: { expand: true, drop: true, move: true }
Użyj go z <ui-component name="treeview">Gdy element nie jest jeszcze ładowany, jComponent Pobierz go po pierwszym użyciu z adresu DEF.fallback (Wydaje się Componentator Autor: Peter Širka Źródło: Componentator Zestaw składników, licencja MIT.
<div style="width:300px;height:200px;border:1px solid #E0E0E0;margin:50px">
<ui-component name="treeview" path="nodes" config="exec:fn_selected"></ui-component>
</div>
<script>
var nodes = [];
nodes.push({ id: '1', name: 'Item 1', html: '<b>Item 1</b>', children: null });
nodes.push({ id: '2', name: 'Item 2', children: null });
nodes.push({ id: '3', name: 'Item 3', children: [{ id: 'A', name: 'SubItem 3 / 1', children: [{ id: 'AA', name: 'SubItem 3 / 1 / 1', children: null }]}]});
nodes.push({ id: '4', name: 'Item 4', children: null });
nodes.push({ id: '5', name: 'Item 5', children: [{ id: 'B', name: 'Subitem 5 / 1', children: null }, { name: 'Subitem 5 / 2', children: [{ id: 'BB', name: 'Subitem 5 / 2 / 1', children: [{ id: 'BC', name: 'Subitem 5 / 2 / 1 / 1', children: null }]}] }, { id: 'BD', name: 'Subitem 5 / 3', children: null }]});
function fn_selected(node, isfolder) {
console.log('SELECTED NODE:', node, isfolder);
}
</script>