angularjs - categorised dropdown select2 -


i using select2 multi select dropdown, , works problem is, want categorise drop down list of same. here code

<script src="/static/select2.js"></script> <input type="hidden" id="test" value=""/> 

and js

$(test).select2({ data:data, multiple: true, width: "100%", placeholder:"none selected", closeonselect:false, }); 

this should work:

$(test).select2({   data:      [       {         text: 'greetings',         children:          [           { 'id': 1, text: 'hai' },            { 'id': 2, text: 'hellow'},          ]       },        {         text: 'questions',         children:          [           { 'id': 3, 'text': 'yes' },            { 'id': 4, 'text': 'no'  }         ]       }     ],   multiple: true,   width: "100%",   placeholder: "none selected",   closeonselect: false, }); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -