RouletteTree - globules-io/OGX.JS GitHub Wiki
RouletteTreeis a proxy object that generates a group of Roulettes, oneRouletteper group. Each Roulette affects its following Roulettes. It is available as a TreedList renderer. It is also bindable to DynamicList.
Stack
Extends
Uxi
Requires
Roulette
OML
{"selector:RouletteTree":{CONFIG}}
Config
{
el:_SELECTOR_, //Where to create the component
data:_OBJECT_, //Data tree
groups:_ARRAY_, //group names per level,
[all other properties for Roulette]
}
Format
If
RouletteTreeis used outside of TreedList, the data format that it expects is as follow
{
canada:{
ontario:{
toronto:{...},
mississauga:{...},
...
},
quebec:{
montreal:{...},
},
...
},
usa:{
vermont:{
burlington:{...},
...
},
...
},
...
}
In this case the
groupsfor the configuration should be set to
['country', 'state', 'city', ...]
Groups are used to dispatch and object with the
OGX.RouletteTree.CHANGEevent, under the format
{country:canada, state:ontario, city:toronto, ...}
You do not have to set the
groupsif you used this component as arenderervia TreedList
Create
RouletteTreecan be created on the fly, at runtime, from an Object extending Uxi
let tree = this.create('RouletteTree', config);
Independently
let tree = OGX.Object.create('RouletteTree', config);
as OML
OGX.OML.render(this, oml);
Methods
tree.val(_OBJECT_); //get or set values for the tree
Example
tree.val({country:'Canada', state:'ON'}); //Set
let obj = tree.val(); //Get
Events
OGX.RouletteTree.CHANGE