使用select2模板输出组

时间:2015-04-01 21:23:37

标签: jquery-select2

我想在使用select2并通过数组加载列表时使所有outgroup标签变为粗体。我的数据如下:

[{"text":"Brands","children": 
[{"text":"BlackBerry","id":"BlackBerry"}, {"text":"Campagnolo","id":"Campagnolo"},   {"text":"Canon","id":"Canon"},{"text":"FujiFilm","id":"FujiFilm"},{"text":"GoPro","id":"GoPro"},{"text":"Nikon","id":"Nikon"},{"text":"Shimano","id":"Shimano"},{"text":"Vans","id":"Vans"}]}, 

{"text":"Benchmarks","children" 
:[{"id":"powertools","text":"Power Tools"},{"id":"shoes","text":"Shoes"},{"id":"clothing","text":"Clothing"},{"id":"camerasPhoto","text":"Cameras and Photo"},{"id":"healthBeauty","text":"Health and Beauty"},{"id":"electronics","text":"Electronics"},{"id":"homeGarden","text":"Home and Garden"},{"id":"sportingGoods","text":"Sporting Goods"}]}] 

我不知道如何使用formatState函数在这种情况下只选择outgroup值Brands and Benchmark并将它们格式化为粗体。

0 个答案:

没有答案