[英]Multi options in select2
I am trying to use select2 to get remote JSON data and display it with mutli levels. 我正在尝试使用select2获取远程JSON数据并以多级别显示它。 http://ivaynberg.github.io/select2/index.html http://ivaynberg.github.io/select2/index.html
This is my response 这是我的回应
{
"Company": [
{
"name": "athenahealth Inc"
},
{
"name": "Localiza Rent a Car"
},
{
"name": "M and B Switchgears"
}
],
"Functional": [
{
"name": "arranger"
},
{
"name": "ambassadors"
}
],
"Persons": [
{
"name": "Moustapha al"
},
{
"name": "Saleh al"
}
]
}
I want to show the result in Multi-Value format - http://ivaynberg.github.io/select2/index.html#multi 我想以多值格式显示结果-http://ivaynberg.github.io/select2/index.html#multi
So far i am able to fetch data from server side , but then i have no idea how to enable the multi select option. 到目前为止,我能够从服务器端获取数据,但是后来我不知道如何启用多选选项。
JSON in following format will work fine 以下格式的JSON可以正常工作
Related issue - https://github.com/ivaynberg/select2/issues/58 相关问题-https://github.com/ivaynberg/select2/issues/58
{ "Data" : [ {
"id" :1 ,
"text" : "Subsection" ,
"children" : [{
"id" : 2,
"text" : "Paru"
},
{
"id" : 3,
"text" : "Vinu"
}]
},
{ "id" : 4 ,
"text" : "Family" ,
"children" : [{
"id" : 5,
"text" : "ChildVM"
},
{
"id" : 6,
"text" : "ChildPM"
}]
}
]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.