Select2 Dependent dropdown lists

前端 未结 3 761
[愿得一人]
[愿得一人] 2021-02-06 01:55

I am trying to use the Select2 plugin to have 4 dropdown lists that depend on each other. I have struggled to find the right way to update the data that loads the options in.

3条回答
  •  离开以前
    2021-02-06 02:34

    Igor has come back to me with a way to do this

    var data=[...];    
    $().select2({data: function() {return {results:data};}});    
    /// later    
    data=[...something else];    
    // next query select2 will use 'something else' data
    

提交回复
热议问题