Autocomplete - Select2 Options

205 views
Skip to first unread message

Will Hieronymus

unread,
Dec 31, 2016, 7:00:35 PM12/31/16
to yourlabs
Some of select2's options are simple to implement, for example:

widget=autocomplete.ModelSelect2(
    url='builder-auto',
    attrs={
               
'data-placeholder': 'Select a Builder',
               
'data-minimum-input-length': 3,
           
},


I'm wondering if it's possible to add more advanced options that need a jquery function via the django form. Or options that require html tags like Disabling Results:

<select class="js-example-disabled-results">
  <option value="one">First</option>
  <option value="two" disabled="disabled">Second (disabled)</option>
  <option value="three">Third</option>
</select>

James Pic

unread,
Jan 1, 2017, 1:27:26 PM1/1/17
to yourlabs

I'd say either use the select2 API to support this in Js, either check the JAL pull request, but there might be other ways I'm not aware of.

Reply all
Reply to author
Forward
0 new messages