alias 来自定义字段名(覆盖缺省配置)
new ChainSelect({
el: '#select1',
alias: {
value: 'id',
label: 'info.name',
name: 'info.type',
children: 'items'
},
data: testData1
});
本例所使用的 testData1 数据如下:
var select2;
$.getJSON('./test-data.json', function(res) {
select2 = new ChainSelect({
el: '#type',
alias: {
value: 'info.areaCode',
label: 'info.areaName',
children: 'subs'
},
data: res
});
// JS 赋值
$('.btn-primary').prop('disabled', false).click(function() {
// 中国 广东 东莞 市辖区
select2.setValues(['CN', 'CN-440000', 'CN-441900', 'CN-441901']);
});
});
本例所使用的大数据样本如下:
loading...