a cascading dropdown list, demo page.
ES6 (lastest)
http://unpkg.com/cascading-select/lib/index.js
ES6 (with version)
https://unpkg.com/[email protected]/lib/index.js
ES5
https://unpkg.com/[email protected]/lib/index.es5.js
ES5 + uglifyJS
http://npm.elemecdn.com/[email protected]/lib/index.es5.js
npm i cascading-select
const CascadingSelect = require('cascading-select')
const data = [/* data */]
const select = new CascadingSelect({ data }).to(document.body)
select.onChange = arr => { console.log(arr) }
console.log(select.selected)
run seed.js to generate test data (browser / nodejs)
or directly see demo page , this page will use random data in each visit.
[
{
"name": "[group name]",
"struct": ["[level-0-name]", "[level-1-name]"],
"data": {
"0": {
"0": [{ "i": "[id]", "n": "[name]" }]
},
"1": {
"[parent id]": [{ "i": "[id]", "n": "[name]" }]
}
}
}
]
todo