Ox.TreeList: add 'expanded' option
This commit is contained in:
parent
c287892606
commit
63d5f04af7
1 changed files with 12 additions and 10 deletions
|
@ -1,17 +1,18 @@
|
|||
'use strict';
|
||||
|
||||
/*@
|
||||
Ox.TreeList <f> TreeList Object
|
||||
([options[, self]]) -> <o:Ox.List> TreeList Object
|
||||
Ox.TreeList <f> Tree List
|
||||
([options[, self]]) -> <o:Ox.List> Tree List Object
|
||||
options <o> Options object
|
||||
data <f|null> data to be parsed to items, needs documentation
|
||||
data <f|null> Data to be parsed as items (needs documentation)
|
||||
expanded <b|false> If true, and data is not null, all items are expanded
|
||||
icon <o|f|null> Image URL, or function that returns an image object
|
||||
items <a|[]> array of items
|
||||
max <n|-1> maximum number of items that can be selected, -1 unlimited
|
||||
min <n|0> minimum number of items that have to be selected
|
||||
selected <a|[]> selected ids
|
||||
width <n|256> list width
|
||||
self <o> shared private variable
|
||||
items <a|[]> Array of items
|
||||
max <n|-1> Maximum number of items that can be selected, -1 unlimited
|
||||
min <n|0> Minimum number of items that have to be selected
|
||||
selected <a|[]> Selected ids
|
||||
width <n|256> List width
|
||||
self <o> Shared private variable
|
||||
@*/
|
||||
|
||||
Ox.TreeList = function(options, self) {
|
||||
|
@ -22,6 +23,7 @@ Ox.TreeList = function(options, self) {
|
|||
var that = Ox.Element({}, self)
|
||||
.defaults({
|
||||
data: null,
|
||||
expanded: false,
|
||||
icon: null,
|
||||
items: [],
|
||||
max: 1,
|
||||
|
@ -172,12 +174,12 @@ Ox.TreeList = function(options, self) {
|
|||
|
||||
function parseData(key, value) {
|
||||
var ret = {
|
||||
expanded: false,
|
||||
id: Ox.uid().toString(),
|
||||
title: key.toString() + ': '
|
||||
},
|
||||
type = Ox.typeOf(value);
|
||||
if (type == 'array' || type == 'object') {
|
||||
ret.expanded = self.options.expanded;
|
||||
ret.title += Ox.toTitleCase(type)
|
||||
+ ' <span class="OxLight">[' + Ox.len(value) + ']</span>';
|
||||
ret.items = type == 'array' ? value.map(function(v, i) {
|
||||
|
|
Loading…
Reference in a new issue